-->

Python Selenium Chrome Disable Pop Up Blocker

2020-07-30 03:39发布

问题:

For some reason I can not figure out how to disable the pop up blocker (to allow pop up windows to work). This use to work, so I am guessing it has something to do with the new version of Chrome/Chromedriver? Below is some sample code, that I know use to work, but now when a pop up happens, I do not even see the icon in the top right, where you can allow the pop up or not. I did also try using the prefs found here to disable the pop up blocker, but that did not work ether. If anyone has a solution, it would be much appreciated!

from selenium import webdriver  
from selenium.webdriver.chrome.options import Options

request_url = 'https://www.example.com'

chrome_options = Options()
chrome_options.add_argument("--disable-popup-blocking")

driver = webdriver.Chrome(chrome_options=chrome_options)
driver.get(request_url)