Automating Authentication popup in Selenium

和自甴很熟 提交于 2019-12-13 01:05:09

问题


I am struggling a bit while automating an authentication pop up in the chrome browser. I am using this test site named "http://the-internet.herokuapp.com/basic_auth"

Here is my code.

public class Authen {

    public static void main(String[] args) throws IOException {
        // TODO Auto-generated method stub

         System.setProperty("webdriver.chrome.driver", "C:\\Users\\Sumedha\\OneDrive\\Documents\\Selenium\\Drivers\\chromedriver_win32\\chromedriver.exe");
          WebDriver driver = new ChromeDriver();
driver.get("http://the-internet.herokuapp.com/basic_auth");
     Runtime.getRuntime().exec("C:\\Users\\Sumedha\\OneDrive\\Documents\\Selenium\\AutoIT\\handleauthentication.exe");   
    }
}

This is how my autoIT script looks.

WinWaitActive("Sign in")
Send("admin")
Send("{TAB}")
Send("admin")
Send("{ENTER}")

Now when I run this, credentials are not entered in the popup and script does not run at all.

Please help !

Thanks in Advance.


回答1:


as cruisepandey writes, put your credentials direct into the url

such pop-ups are not browser's component, but OS's

those pop-ups are not accessible via selenium, a malware could penetrate if it would be possible.



来源:https://stackoverflow.com/questions/50283307/automating-authentication-popup-in-selenium

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!