简体   繁体   中英

Hide Windows Leave/Cancel Pop-up by capabilities

I'm working with Selenium, Java and Browserstack. Usually I develop in MacOS and I improve the compatibility with the remote browser. I'm trying to execute the same test cases that are working properly in MacOS, into a Windows remote machine.

The problem appears when I let a form incomplete because and I have clicked on a Cancel button to back again to the previous page. In this scenario the default chrome alert appears:

在此处输入图像描述

I have tried the Chrome option:

options.addArguments("--disable-notifications");

Also:

options.addArguments("--disable-popup-blocking");

And with:

prefs.put("profile.default_content_settings.popups", 0);

I know I can use a condition in the cancel button associated to the system configuration, where the selenium code accept the alert, but I'm searching an option more cleaning and easy.

Do you know any other option, capability or whatever, that could block those pop-ups but not the others?

Thank you in advance.

EDIT NOTE It is something related with Chrome pop-ups only.

Please try prefs.put("profile.default_content_setting_values.notifications", 2);

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM