I am scraping a website with Selenium, and this pops up and then Selenium can't do anything. How can I bypass this?
CodePudding user response:
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("");
CodePudding user response:
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})