Handling child window in selenium using selectWindow()
Here is a scenario which shows how to handle a child window using selenium .
Web application under Test : Liferay Portal
Browser Used : Firefox
XPath Tools : Firebug
STEP 1: First Identify the window name of the child window which the web application calls. You can use firebug tool to inspect the GUI element to see these details. In the example below, the "select" button is going to invoke a child window "structure".
window.open(url, windowName, windowFeatures, replaceFlag)


STEP 2: Once you identify the child window name, then within your automation script, call the below selenium command "selectWindow" with the child window name as the parameter . Here in this example the corresponding command is browser.selectWindow("structure")
Now the focus goes to the child window. What ever you execute after the above command takes place in the child window .

STEP 3: Inorder to get the focus back to the parent window, you have to again use "selectWindow" with the parameter as null. browser.selectWindow(null)
