Selenium click() method doesn't return after clicking a link that shows a modal dialog.

32 views
Skip to first unread message

jha...@gmail.com

unread,
Jun 23, 2014, 4:50:04 PM6/23/14
to phan...@googlegroups.com

I'm having an issue where the click() method never returns after clicking a link that shows a modal dialog via JavaScript.  Here is what my code looks like:

The PhantomJS driver is being setup like this:

DesiredCapabilities capability = new DesiredCapabilities();
capability.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, new String[] {
 "--webdriver-loglevel=DEBUG"
});
WebDriver driver = new PhantomJSDriver(capability);


The test code that is hanging looks like this:

driver.findElement(By.linkText("Start Process")).click()
driver.switchTo().frame("prcBegin");

Here, the click() method never returns.  I've waited up to 5 minutes for it before manually killing the test.

The HTML for the link that is being clicked looks like this:

<a href="javascript:showModalDialog();">Start Process</a>


This only occurs with PhantomJS.  I've tested it with Firefox, Safari, Chrome, IE9-IE11, and HtmlUnitDriver and none of them have this issue..., that is why I am assuming it is something specific to PhantomJS.  Any ideas what is going on or how I could work around it?
Reply all
Reply to author
Forward
0 new messages