Reputation: 3129
Each time I move into new IE browser to run Selenium automation scripts which deals with pop-up handling, I need to disable pop-up blocker option from IE settings manually. Is there a way to disable IE pop-up blocker programmatically by using some capability or something?
Upvotes: 6
Views: 6717
Reputation: 3129
We have to modify Registry value to be able to manipulate pop-up blocker in IE. Registry information is given below:
Registry Location: HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\New Windows
Registry Value Name: PopupMgr
Registry Value Data: no [Turn off pop-up blocker] and yes [Turn on pop-up blocker]
If you are with Java and want to achieve it programmatically, following code snippet will surely help you:
String cmd = "REG ADD \"HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\New Windows\" /F /V \"PopupMgr\" /T REG_SZ /D \"no\"";
try {
Runtime.getRuntime().exec(cmd);
} catch (Exception e) {
System.out.println("Error ocured!");
}
Hope it helps!
Upvotes: 2
Reputation: 199
Yes, you can use like this in Ruby binding WebDriver:
caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer('ie.unexpectedAlertBehaviour' => 'accept', 'ignoreProtectedModeSettings' => true)
@driver = Selenium::WebDriver.for(:ie, :desired_capabilities => caps)
Let me know if that works for you! otherwise change 'ie.unexpectedAlertBehaviour' => 'dismiss'
either one should be works
Upvotes: 0