Selenium如何发送凯斯"找不到页面上的#34;

时间:2018-05-22 01:50:25

标签: java selenium selenium-webdriver selenium-chromedriver selenium-ide

我编写的selenium驱动程序有自动登录但我无法在登录表单上找到任何内容。

如何在此表单上输入密码和帐户中的文字?

Blank form need to input text

3 个答案:

答案 0 :(得分:0)

这不是HTML表单。这是OS提供的对话框,而不是浏览器。所以你不能用selenium来自动化它。

您可以使用Java类Robot来操作它,但Robot类只能在脚本所在的本地操作对话框。如果您使用RemoteWebDriver并在远程计算机上打开浏览器,Robot类将无法工作。

据我所知,同时支持本地和远程案例没有好的解决方案。

答案 1 :(得分:0)

您正在谈论基本身份验证,并且有一些解决方案。

Selenium - Basic Authentication via url

通过url中的凭据(不再适用于chrome)或chrome中的远程调试。

Chrome remote debugging in a seleniumgrid

答案 2 :(得分:0)

试试这个

16px

如果你在java中使用selenium试试这个

import org.openqa.selenium.NoAlertPresentException;	
import org.openqa.selenium.Alert;
driver.switchTo().alert().sendKeys("username" + Keys.TAB + "password"); 
driver.switchTo().alert().accept();