History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: SEL-339
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Dan Fabulich
Votes: 4
Watchers: 3
Operations

If you were logged in you would be able to see more operations.
Selenium

Can't select popUp window opened before onload

Created: 19/Oct/06 06:59 PM   Updated: 28/Nov/07 10:12 AM
Component/s: Pop-Up Windows
Affects Version/s: None
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown


 Description  « Hide
This has been a known issue forever, but I couldn't find a JIRA issue on it, so I'm filing one now. We intercept calls to window.open, replacing window.open a function of our own devising, but if a call to window.open happens before we can replace it, the window will open without our knowledge, and we'll have no record of its id/name.

There's an interesting workaround I just learned about however: http://www.irt.org/script/782.htm

winHandle = window.open('','windowName');

The first parameter (the url) is passed as an empty string, which should result in the contents of the window remaining unchanged.

In my projects here, as a workaround, I instructed the users to getEval("window.open('', 'foo')") and then selectWindow("foo") to open that window. We should consider adding functionality like this directly into selectWindow.

 All   Comments   Work Log   Change History      Sort Order:
Benjamin Schmid - 31/Jul/07 11:29 AM
I got crazy to get it running and the solution was soooo easy with this hints and http://forums.openqa.org/thread.jspa?messageID=22950&#22950

My task was:
Select a (named) popup window opened via the onload event in the java rc.

Problem:
The window is opened via <body onload="window.open(xxx, dsw_popup,...)">.
Selenium does not know about these popup windows as it is unable to modify open function.
Hence it is inivisble for all storeWindowNames or other selenium functions.

As solution this simple code worked:
    public void selectPopUp(){
        selenium.openWindow("","dsw_popup");
        selenium.selectWindow("dsw_popup");
   }

insteadof only selectWindow. That easy!

Maybe include this in core if it is feasible

Dan Fabulich - 28/Nov/07 10:12 AM
The problem with baking this into core is that if the window really *doesn't* exist yet, then openWindow("", "foo") will open up a new blank window; probably not what you want.