findElement by.xpath不适用于Html5节标记?

时间:2014-07-31 07:26:37

标签: java xpath selenium-webdriver

xpath的findElement不适用于section标签。我尝试了几次xpath也不是动态的,它是静态的,但我仍然得到这个消息

  

线程“main”中的异常org.openqa.selenium.NoSuchElementException:无法找到元素:{"method":"xpath","selector":"/html/body/div[2]/section/div/div/div/div/div/form/div/div[2]/div[3]/div/div[2]/div/input"}   命令持续时间或超时:6.66秒“

我还搜索了几个关于这个问题的表格,许多人说使用最新的selenium standlone jar文件。我只使用最新版本“selenium-server-standalone-2.42.2.jar”

相关HTML:

<div id="uploading-url">
   <p class="reduce-space"><img alt="web_image" src="/images/content/duelr/web.png"></p>
   <input placeholder="Enter URLs to upload from web" type="text">
</div>

1 个答案:

答案 0 :(得分:2)

使用以下xpath获取input标记的元素:

//div[@id='uploading-url']//input
相关问题