Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/xpath/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xpath 错误:无法定位元素_Xpath_Selenium_Css Selectors - Fatal编程技术网

Xpath 错误:无法定位元素

Xpath 错误:无法定位元素,xpath,selenium,css-selectors,Xpath,Selenium,Css Selectors,我必须使用ZK框架测试一个动态应用程序,Selenium无法识别不同元素的id,因此无法在文本框中输入文本或在列表中选择元素(数据库中的元素) 无论我使用什么(xpath或css选择器),都没有任何效果,总是相同的错误 有人知道我如何解决我的问题吗 我正在使用Selenium IDE 1.9.0 Netbeans IDE 7.1.1 和Firefox16.0.2 谢谢 Html代码是: button id="zc_subdossierzulButton_8" class="butt z-butt

我必须使用ZK框架测试一个动态应用程序,Selenium无法识别不同元素的id,因此无法在文本框中输入文本或在列表中选择元素(数据库中的元素)

无论我使用什么(xpath或css选择器),都没有任何效果,总是相同的错误

有人知道我如何解决我的问题吗

我正在使用Selenium IDE 1.9.0

Netbeans IDE 7.1.1

和Firefox16.0.2

谢谢

Html代码是:

button id="zc_subdossierzulButton_8" class="butt z-button-os" style="border-style: solid;border-width: 1px;border-color: #ED0000;" type="button">Rechercher 不工作

这:

driver.findElement(By.cssSelector("butt z-button-os")); 
不工作

这是:

String cssSelector = "[class='butt z-button-os']"; 
driver.findElement(By.cssSelector(cssSelector)).clear(); 
driver.findElement(By.cssSelector(cssSelector)).sendKeys("c");

请阅读以下文档并尝试使用不同的选项,如

driver.findElement(By.id("coolestWidgetEvah"));
OR
driver.findElements(By.className("cheese"));
OR
driver.findElement(By.tagName("iframe"));
OR
driver.findElement(By.name("cheese"));
OR
driver.findElement(By.linkText("cheese"));
OR
driver.findElement(By.partialLinkText("cheese"));
OR
driver.findElements(By.xpath("//input"));


错误:Unalb eto定位元素:{“方法”:“css选择器”,“选择器”:“[class='butt z-button-os']”您可以尝试找出动态ID中的常见模式,然后使用xpath/css形成定位器。您必须为任何人粘贴一些html来帮助您解决问题。我尝试了以下方法:driver.findElement(By.cssSelector(“zc_subdossierzulButton_8.butt”);不要这样做:driver.findElement(By.cssSelector(“Buttz-button-os”);不工作,请执行以下操作:字符串cssSelector=“[class='butt z-button-os']”;driver.findelelement(By.cssSelector(cssSelector)).clear();驱动程序.findelelement(由.cssSelector(cssSelector))发送键(“c”);请显示您的html代码以使事情更清楚..Rechercher
driver.findElement(By.id("coolestWidgetEvah"));
OR
driver.findElements(By.className("cheese"));
OR
driver.findElement(By.tagName("iframe"));
OR
driver.findElement(By.name("cheese"));
OR
driver.findElement(By.linkText("cheese"));
OR
driver.findElement(By.partialLinkText("cheese"));
OR
driver.findElements(By.xpath("//input"));