Unable to handle Sign-in pop-up using selenium web-driver for any of the browsers

Deadly 提交于 2019-12-13 08:59:08

问题


I am trying to hit a URL which asks for authentication pop-up which is neither a window pop-up nor a browser pop-up .

The code driver.get("myURL") will hang/pause unless this popup is entered with user name and password manually . Once the credentials are entered manually , the automation script continues - the next line of driver.get("myURL").

Everywhere AutoIT and other alert methods are mentioned.But the problem is , the code never reaches the next line of driver.get("myURL") unless it is handled manually.

The same URL navigates to login web page on my local machine which I can handle using selenium webdriver without any problem as no alert pops-up.ScreenShotBut the same URL opened in server machine - asks this popup to enter user name and password.


回答1:


You can pass the authentication with your URL in driver.get(). To do so just add the credentials directly after the protocol separated by : and ending with @ before your actual URL.

For example if your user is "user" and your password is "password": driver.get("https://user:password@yourpage.com");




回答2:


Found solution for this , can be handled through thread concept

Thread t = new Thread(new Runnable() {
            public void run() {
                System.out.println(Thread.currentThread().getName());
                driver.get(Thread.currentThread().getName());
            }
        }, url);
        t.start();
// Next line of code :AutoIT or Robot or Sikuli to handle security pop-up


来源:https://stackoverflow.com/questions/50982895/unable-to-handle-sign-in-pop-up-using-selenium-web-driver-for-any-of-the-browser

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