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, after logging in, chrome browser shows a dialog regarding facebook notifications ( Chrome Popup )
The dialog seems to be generated by the browser, not the page itself.
i'm unable to identify and capture the element or use "switch to alert" method.
How can i interact with this dialog (either Allow, Dismiss or close it)?
Thanks!
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)
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);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.