P G*_*har 5 java selenium selenium-webdriver
我是selenium webdriver的新手.我正在尝试注册http://way2automation.com/way2auto_jquery/index.php.
我可以切换到弹出窗口并能够填充所有字段值.但是,当我尝试单击SUBMIT按钮时,它显示异常Exception in thread "main" org.openqa.selenium.ElementNotVisibleException: element not visible
我在下面的代码中使用了Xpath:
driver.findElement(By.xpath(".//*[@id='load_form']/div/div[2]/input")).click();
Run Code Online (Sandbox Code Playgroud)
HTML是:
<div class="span_1_of_4" align="center">
<input class="button" type="submit" value="Submit">
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.提前致谢
正如我在您提供的网站网址中看到的那样,有两个Submit按钮,因此当您使用 xPath 时,.//*[@id='load_form']/div/div[2]/input它会返回两个提交按钮,然后单击第一个Submit按钮,该按钮在表单上不可见,因此您应该尝试如下:-
driver.findElement(By.cssSelector("div#load_box input.button")).click();
Run Code Online (Sandbox Code Playgroud)
希望它能起作用..:)
| 归档时间: |
|
| 查看次数: |
1156 次 |
| 最近记录: |