Sunday, October 14, 2012

Webdriver - Modal dialog support

Webdriver modal dialog support

How to handle IE modal pop-up in Selenium Webdriver?

Modal dialog? When it is called system displays a dialog that user need to deal with before interacting with the rest of the page.

We can handle the modal dialog through selenium2.0 (Webdriver) in IE, but at few places Selenium is getting stuck with the modal dialog, need to use alternative approach to over come this limitations ( Java Robot class). Currently, Selenium don’t support the modal dialog in Firefox, Safari, Chrome and Opera. 

IE support the modal dialog from Version 4.
Firefox added the support from Version 3.
Safari added the support from version 5.1.
Opera don’t support.
Chrome support from initial versions, but has following bugs Issue 16045, Issue 42939.

Other issues:
1.       Modal dialog as popup – Firefox, chrome and safari consider it as popup and default block it, user need to turn it on.
2.       Debugging – We can’t debug the code even on the latest IE9. Firefox, safari and chrome will let us open the Firebug/Web inspector but difficult to debug.
3.       Mobile – Currently no mobile browser support modal dialog.

It is an old API, but it has been added to the HTML5 spec as there are many old applications written using modal dialog, better to eliminate the “Modal dialog” in the new implementation where multi browser support is required  and usefollowing better options.


Wednesday, October 3, 2012

webdriver - modal dialog present

selenium webdriver modal dialog present

Recently we came across a situation where there is no modal dialog or alert, but selenium through "modal dialog present" exception, this issue occurred when there are multiple alerts in the same transaction.

Even the JavaScript executor is not working at this stage, I think Selenium team need to remove the "Modal Dialog Present" validation from the executor, so that when can proceed ahead by running code through JavaScript .

In order to overcome this situation we have used alert.dismiss(), so that selenium proceeded ahead without any exception.