Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/323.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
Java 硒中没有这种元素例外_Java_Selenium_Selenium Webdriver - Fatal编程技术网

Java 硒中没有这种元素例外

Java 硒中没有这种元素例外,java,selenium,selenium-webdriver,Java,Selenium,Selenium Webdriver,我们使用普通的HTML和CSS开发了一个完整的应用程序。 使用SELENIUMIDE进行正常录制和播放时,效果非常好,但当我们使用SELENIUM

我们使用普通的HTMLCSS开发了一个完整的应用程序。 使用SELENIUMIDE进行正常录制和播放时,效果非常好,但当我们使用SELENIUM编写脚本时,会抛出错误为“NoTouchElementException

这是我编写的代码。

<div class="form-group">
  <label for="uname">User Name:</label>
  <input type="text" class="form-control" id="uname" name="name" placeholder="Enter User Name" value="">
    <div id="uerror" class="error"></div>
</div>
<div class="form-group">
  <label for="pas">Password:</label>
  <input type="password" class="form-control" name="password" id="pas" placeholder="Enter password" value="">
  <div id="perror" class="error"></div>
</div>
<button type="button" class="btn btn-primary center-block" id="loginb" >SIGN IN</button>

用户名:
密码:
登录

从哪里获得异常?driver.findElement(By.xpath(“/*[@id='uname'])).sendKeys(“user_sam”);在用户名字段中输入数据时出现此行。登录表单是否在弹出窗口中?您应该实现显式或隐式等待用户输入element@guy登录表单不在弹出窗口中。
<div class="form-group">
  <label for="uname">User Name:</label>
  <input type="text" class="form-control" id="uname" name="name" placeholder="Enter User Name" value="">
    <div id="uerror" class="error"></div>
</div>
<div class="form-group">
  <label for="pas">Password:</label>
  <input type="password" class="form-control" name="password" id="pas" placeholder="Enter password" value="">
  <div id="perror" class="error"></div>
</div>
<button type="button" class="btn btn-primary center-block" id="loginb" >SIGN IN</button>