【发布时间】:2016-03-30 04:37:02
【问题描述】:
这是我的 Java 代码
List<?> imageList =driver.findElementsByXPath("//*[@class='android.widget.ImageButton' and @index='0']");
我想将类和索引更改为随机值。 我尝试设置两个变量并替换类和索引值,但它不起作用。
List<?> imageList =driver.findElementsByXPath("\"//*"+"[@class="+"'"+Itemname+"'"+" "+"and"+" "+"@index="+"'"+Value+"'"+"]\"");
错误消息是
Exception in thread "main" org.openqa.selenium.NoSuchElementException: An element could not be located on the page using the given search parameters.
有什么办法可以帮我解决这个问题吗? 非常感谢您的时间和帮助。
【问题讨论】:
标签: java android selenium xpath