【发布时间】:2020-03-31 03:47:02
【问题描述】:
我面临一个问题。我做了一个函数来捕获段落标签的值。对于单个段落,它可以完美运行,但段落标签太多。如何在函数中检索这些值?
public String captureText(WebDriver driver) {
String captureValue;
captureValue = driver.findElement(By.xpath("//span[text()='Subtitles']//following::p[1]")).getText();
return captureValue;
}
我的函数如上所示。
【问题讨论】:
标签: java selenium selenium-webdriver xpath