Skip to content Skip to sidebar Skip to footer

How To Close Chrome Browser Popup Dialog Using Selenium Webdriver And Python

I have a python code that uses selenium webdriver (along with chromedriver), to log into facebook and take a screenshot of the page. the script itself works as expected, however, a

Solution 1:

in Python you can use

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--disable-notifications")
webdriver.Chrome(os.path.join(path, 'chromedriver'),
                 chrome_options=chrome_options)

Solution 2:

You can try with launching the chrome browser with disabled pop-ups (browser pop-ups). The following code snippet is in Java. It will be somewhat similar in python i believe.

ChromeOptions options = new ChromeOptions();
options.addArguments("--disable-popup-blocking");
options.addArguments("test-type");
ChromeDriver driver = new ChromeDriver(options);

Post a Comment for "How To Close Chrome Browser Popup Dialog Using Selenium Webdriver And Python"