0
votes

I'm running a Selenium webdriver test in FireFox. After clicking on a button a Javascript (JQuery/Bootstrap) alert has to appear but no matter how I run the program (eclipse, debug mode, executable Jar) this alert never appears.

When executing exactly the same action by hand the alert appears always, even when I used the same browser session that was started up by the Selenium webdriver test. I'm using Selenium Webdriver 2.53 Java 1.7 Firefox 46.0.1 under Windows 10.

Anybody an idea why this alert doesn't appear

1
Recently I figured out that the waiting time of 10 seconds in my testprogram was not enough. After waiting for about 15 seconds the alertbox finally sppears. Curious because when testing manually it only takes two or Three seconds before the alertbox appears.Frank

1 Answers

2
votes

Actually in Selenium webdriver for Firefox by default the alert box is dismissed if it is appear.

So modify your DesiredCapabilities before initializing WebDriver to ignore this behavior by setting as follows :-

    DesiredCapabilities capabilities = DesiredCapabilities.firefox()
    capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR,"ignore");

Hope this will help you..