Python Windows Authentication username and password is not working

后端 未结 2 1520
生来不讨喜
生来不讨喜 2020-11-22 08:58

I am trying to enter data in prompt (URL Given), below codes is giving me an error. Please help me out with these?

from selenium import webdriver
from seleni         


        
2条回答
  •  没有蜡笔的小新
    2020-11-22 09:35

    When you work with Selenium 3.4.0, geckodriver v0.18.0, Mozilla Firefox 53.0 through Python 3.6.1 you can bypass the Basic Authentication popup through embedding the username and password in the url itself as follows.

    This solution opens the URL http://the-internet.herokuapp.com/basic_auth and authenticates with a valid username and password credentials.

    from selenium import webdriver
    from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
    
    binary = FirefoxBinary('C:\\Program Files\\Mozilla Firefox\\firefox.exe')
    driver = webdriver.Firefox(firefox_binary=binary, executable_path="C:\\Utility\\BrowserDrivers\\geckodriver.exe")
    driver.get("http://admin:admin@the-internet.herokuapp.com/basic_auth")
    

提交回复
热议问题