PopUpWindow Finder Issue in Chrome

210 views
Skip to first unread message

Dreamer

unread,
Dec 18, 2012, 3:06:24 PM12/18/12
to webd...@googlegroups.com
Hi All,

This little bugger getting me all tied up. I'm supposed to know webdriver inside out and indeed I do but here goes...
Basically the snippet below is what I'd expect to use when I'm switching between windows but for some reason it doesnt seem to work. The second lineworks by click the link that opens the pop up. The window handle i.e finder is never returned. #

This is what I get ( it basically times out ) the selenium session seems to hang or the newly popped up window somehow isnt reachable and, the existing driver just hangs.


 OpenQA.Selenium.WebDriverException : No response from server for url http://localhost:41747/session/533130f80a1291a168e923def02847e3/element/:wdc:1355860570936/

           string current = driver.CurrentWindowHandle;
            var finder = new PopupWindowFinder(driver,TimeSpan.FromSeconds(10)).Click(Order);
            driver.SwitchTo().Window(finder);

Jim Evans

unread,
Dec 18, 2012, 3:26:24 PM12/18/12
to webd...@googlegroups.com
A couple of questions: Does this happen with other browsers, or only Chrome[1]? Can you reproduce the problem on another site that uses a popup window, or can you share the HTML (or a link to a public URL) that demonstrates the issue? I've run the integration tests for the PopupWindowFinder class[2] using Chrome, and they work fine.

To those of you keeping score at home, yes, the PopupWindowFinder class is a class provided by WebDriver, but only (as far as I know) in the .NET bindings. It's located in the WebDriver.Support.dll assembly.

--Jim

[1] If your answer is, "I don't know," then that's a piece of information that would really be good to have.
[2] http://selenium.googlecode.com/svn/trunk/dotnet/test/WebDriver.Support.Tests/UI/PopupWindowFinderTest.cs

Dreamer

unread,
Dec 19, 2012, 5:39:25 AM12/19/12
to webd...@googlegroups.com
Hi jim,

Here's an identical example it turns out its a window modal box that being pop up (not a jquery modal- which is an in page div).
If you click on the  "launch Window" button on
 a new pop up is launched. but selenium is blocked, in fact it occasionally throws an UnhandledAlertException. Here's an article that articulates my issues.  

Dreamer

unread,
Dec 20, 2012, 10:24:35 AM12/20/12
to webd...@googlegroups.com
By the way , this happens on all browsers....


On Tuesday, December 18, 2012 8:26:24 PM UTC, Jim Evans wrote:

Dreamer

unread,
Dec 20, 2012, 10:34:25 AM12/20/12
to webd...@googlegroups.com
So I found the offending function spawndialog and a fix for it spawnwindow

//New Modal dialog
var myDialog;
function spawndialog(a, b)
{
myDialog=window.showModalDialog(a,b);
}

//New Window PopUp
var mywindow;
function spawnwindow(a,b,c)
{
mywindow=window.open(a,b,c);
if (window.focus) {mywindow.focus()}
}
//End

There a button on the web page which calls function spawnwindow(a,b,c) which causes the error

so here what I did, I dont click the button at all> I just execudete javascript from selenium code calling the function spawnwindow(a,b,c) instead. and passing the required vaviables into the function.

((IJavaScriptExecutordriver).ExecuteScript(jscript);
That's it folks


The Dreamer



Reply all
Reply to author
Forward
0 new messages