How to handle browser login popup using Selenium & Java

前端 未结 2 750
青春惊慌失措
青春惊慌失措 2021-01-28 18:19

The website that I am trying to automate has a authentication popup that appears when someone visits it. I tried the following code but Chrome immediately throws no alert presen

相关标签:
2条回答
  • 2021-01-28 18:38

    Do you need check it or pass it? If you need to pass, put login and password in URL.

    http://username:password@your-web-site.com
    
    0 讨论(0)
  • 2021-01-28 18:42

    Selenium do not handle it by switchto command because this is something that is browser specific instead of website.

    Solution 1:

    driver.get("http://username:password@url.com");

    But problem with this method is that as you traverse to multiple pages the popup will appear again and again which is again difficult to handle.

    Solution 2: (Recommended)

    AutoIt script, Download AutoIt here And Find the Script for Authentication PopUp here

    0 讨论(0)
提交回复
热议问题