我正在尝试使用xpath单击元素。但它不起作用。
<a id="ProductListProductLink_414303" data-test="ProductListProductLink_3" href="http://uat-staging.wc7.dunelm.com/product/dorma-red-capri-collection-flat-sheet?searchTerm=sheet double">
我尝试了五月。但没有用。
有人可以帮我吗?
确保使用('')单引号传递xpath id。当您从浏览器复制xpath时,它带有双引号。
下面的示例将帮助您了解xpath的基本概念:
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
driver.findElement(By.xpath("//*[@id='gbqfq']")).sendKeys("software testing");
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句