无法对选定的html标记使用sendkeys

时间:2014-09-18 18:12:16

标签: selenium xpath

无法对所选的html标记使用sendKeys。我可以在Chrome控制台中选择标签,但不能在执行selenium时选择。

HTML我正在尝试访问

      <span class="_fp_t">
 <form autocomplete="off" action="javascript:void(0);" class="_fp_v">
 <input autoid="_fp_7" class="_fp_u textbox ms-font-weight-regular ms-border-color-neutralTertiary ms-font-color-neutralPrimary allowTextSelection hideClearButton placeholderText" role="combobox" autocorrect="off" autocapitalize="off" aria-haspopup="true" style="width: 25px;"> 
</form>
 </span>

我已尝试过以下代码,但它无效

这是Chrome控制台中使用的html标记:

$x("//input[@autoid='_fp_7'][@style='width: 25px;']")

此代码用于selenium代码:

driver.findElement(By.xpath("//input[@autoid='_fp_7'][@style='width: 25px;']")).sendKeys("testing10@yopmail.com");

抛出错误: 线程&#34; main&#34;中的例外情况org.openqa.selenium.NoSuchElementException:没有这样的元素   (会议信息:chrome = 37.0.2062.120)

(驱动程序信息:chromedriver = 2.9.248315,platform = Windows NT 6.3 x86_64)(警告:服务器未提供任何堆栈跟踪信息) 命令持续时间或超时:31毫秒

0 个答案:

没有答案