Sometimes pages are secured using Basic HTTP Authentication (Basic Auth) to prevent unauthorized access. A system level pop-up prompts to enter username and password and Selenium will not be able to access it.
A Chrome Add-on can be used to insert the credentials when Selenium access the Page
GET /basic-auth/user/passwd HTTP/1.1
Host: httpbin.org
Connection: keep-alive
Authorization: Basic dXNlcjpwYXNzd2Q=
git clone https://github.com/arunelias/Selenium-Chrome-Addon.git
details.requestHeaders.push({name: "Authorization",value: "Basic dXNlcjpwYXNzd2Q="});
Example:
from selenium import webdriver # Set Chrome options. options = webdriver.ChromeOptions() # Modify the path of the folder options.add_argument('--load-extension=path/to/the/extension/folder') driver = webdriver.Chrome(chrome_options=options) driver.get('https://httpbin.org/basic-auth/user/passwd') # Your Code goes here... driver.quit()