li
我必须计算中存在的元素数量div
。以下是网页的 HTML 部分:
我编写了以下几行代码来计算图块:
public void configButtonCount()
{
WebElement button= driver.findElement(By.className(".config-category"));
List<WebElement> buttonCount = button.findElements(By.xpath("//li"));
System.out.println("List size is: " +buttonCount.size());
}
Run Code Online (Sandbox Code Playgroud)
谁能告诉我为什么它显示为Unable to locate element: .\.config\-category"
另外,正确的代码行?