List <WebElement> we = driver.findElements(By.xpath("//h3[text()='Quick Links ofHyderabad']/following::ul/a"));
int noOfLinks = we.size();
// To click on all the links just use a `for` loop
for(WebElement w : we) {
w.click();
}
# 2 楼答案
根据需要自定义代码。应该是这样的:
//Pick all div elements:
List< IWebElement > elements = driver.FindElements(By.XPath(//div[contains(@class, 'description')]/h3));
// Now use a forloop to go through each element and grab the data you need.
String Data = elements.getText();
// Split the Data using regex and get the count as per your html code
# 1 楼答案
您可以这样做:
# 2 楼答案
根据需要自定义代码。应该是这样的: