how to handle org.openqa.selenium.UnhandledAlertException in selenium webdriver -
i getting pop while executing script:
modal dialog present: script on page may busy, or may have stopped responding. can stop script now, or can continue see if script complete.
can please mention how handle clicking continue button.please find out url below see screenshot http://i.stack.imgur.com/exxfo.png
it because of default behavior of driver when reaches alert. default behavior - "accept", alert closed automatically. that's why switchto().alert()
couldn't find it.
at time of creating desirecapabilities
can modify it.
desiredcapabilities dc = new desiredcapabilities(); dc.setcapability(capabilitytype.unexpected_alert_behaviour, unexpectedalertbehaviour.ignore); webdriver driver = new firefoxdriver(dc);
to handle,
// untill timeout try { alert alt = driver.switchto().alert(); alt.accept(); } catch(noalertpresentexception noe) { // no alert. }
Comments
Post a Comment