0

I am scraping a website with Selenium, and this pops up and then Selenium can't do anything. How can I bypass this?

enter image description here

Nicolas Gervais
  • 33,817
  • 13
  • 115
  • 143
  • Have you tried [this](https://stackoverflow.com/questions/31430532/python-selenium-chrome-disable-prompt-for-trying-to-download-multiple-files)? – Kamalesh S Sep 16 '21 at 04:53

2 Answers2

1

You need chrome options to get rid off of that.

I have these options in one of my project.

options = webdriver.ChromeOptions()

options.add_argument("--disable-infobars")
options.add_argument("--start-maximized")
options.add_argument("--disable-extensions")
options.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 1})
options.add_argument('--window-size=1920,1080')
options.add_experimental_option("prefs", {"profile.default_content_setting_values.automatic_downloads": 1})

and then initialize browser object like this :

driver = webdriver.Chrome(executable_path = driver_path, options = options)

or

driver = webdriver.Chrome(options = options)

the option that will help us in this case is

options.add_experimental_option("prefs", {"profile.default_content_setting_values.automatic_downloads": 1})
cruisepandey
  • 28,520
  • 6
  • 20
  • 38
0

If you want just bypass the browser level popups, we can achieve thru ChromeOptions class

ChromeOptions options=new ChromeOptions();
options.addArguments("disable-notifications");

pass the ChromeOptions object to WebDriver

WebDriver driver=new ChromeDriver(options);
driver.get("");