我需要访问该网站上搜索结果的链接()并将它们放入WebElement
,但我无法按班级或任何其他方式找到它们。使用时xpath
:
MyWebDriver.findElement(By.xpath("//div[@class=inner-results firma]")).click();
我收到此错误:
"Given xpath expression "//div[@class=inner-results firma]" is invalid: SyntaxError: The expression is not a legal expression."
如何访问所有结果链接?
The xpath
应该"//div[@class='inner-results firma']"
,用引号引起来class
属性。您还应该使用findElements
获得多个结果
MyWebDriver.findElements(By.xpath("//div[@class='inner-results firm']")).click();
附带说明一下,Java 中的变量应以小写字母开头,MyWebDriver
-> myWebDriver
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)