Python Selenium Chrome禁用弹出窗口阻止程序

时间:2017-12-14 16:07:24

标签: python python-3.x google-chrome selenium selenium-chromedriver

由于某种原因,我无法弄清楚如何禁用弹出窗口阻止程序(允许弹出窗口工作)。这个使用起作用,所以我猜它与Chrome / Chromedriver的新版本有关?下面是一些我知道用来工作的示例代码,但现在当弹出窗口时,我甚至看不到右上角的图标,您可以在哪里允许弹出窗口。我也尝试使用prefs found here来禁用弹出窗口阻止程序,但这不起作用。如果有人有解决方案,我们将不胜感激!

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)

0 个答案:

没有答案