How to handle authentication popup with Selenium WebDriver using Java

前端 未结 7 1799
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 05:36

I\'m trying to handle authentication popup using the code below:

FirefoxProfile profile = new FirefoxProfile();
profile.setPreference(\"network.http.phishy-u         


        
7条回答
  •  长情又很酷
    2020-11-22 06:07

    The Alert Method, authenticateUsing() lets you skip the Http Basic Authentication box.

    WebDriverWait wait = new WebDriverWait(driver, 10);      
    Alert alert = wait.until(ExpectedConditions.alertIsPresent());     
    alert.authenticateUsing(new UserAndPassword(username, password));
    

    As of Selenium 3.4 it is still in beta

    Right now implementation is only done for InternetExplorerDriver

提交回复
热议问题