如何计算与给定xpath表达式匹配的元素数
xpath: driver.findElement(By.xpath("//div[contains(@id,'richedittext_instance')]"))
我需要的只是计数。
试试这个代码:
//Assume driver is intialized properly. int iCount = 0; iCount = driver.findElements(By.xpath("Xpath Value")).size());
的iCount具有相同的元件的数目xpath的值。
iCount
xpath