SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

Selenium - How to select window if window do not have title or name

Selecting new opened window using "selectWindow" command in selenium IDE is very easy if new window has title or name. Click here to view example of "selectWindow" command with title as a target. If window has title then we can add it's title in target field with "selectWindow" command and this way selenium
can identify window. But how to handle window which has not any title? Let we consider one scenario for such case. Supposing I am clicking on hyper link and opening new window. New window has not any title and I want to select that window to perform some actions on newly opened window using selenium IDE. How can I do it?

"storeAttribute" command will help us to handle this scenario. look at bellow given example.

(Note : Please set Block Pop-up windows = false before running this test case case. Otherwise bellow given script will not run properly.)

Example of how to handle window without title or name or id in selenium

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/testing.html
clicklink=Visit MyTest Page
storeAttributelink=Visit MyTest Page@targetwindow1
selectWindow${window1}
waitForElementPresentname=fname
pause2000
highlightname=fname
typename=fname1st time visit
of window1
selectWindownull
clicklink=Visit Testing Page
storeAttributelink=Visit Testing Page@targetwindow2
selectWindow${window2}
waitForElementPresentname=vehicle
pause2000
highlightname=vehicle
clickname=vehicle
selectWindow${window1}
pause2000
highlightname=fname
typename=fname2nd time visit
of window1
pause2000
selectWindow${window2}
pause2000
highlightname=gender
clickname=gender
selectWindow${window1}
close
selectWindow${window2}
close

Above script is very long so full script description is very lengthy. Let me tell you main commands. 1st of all, i have not used window title or name id to select window. So please consider that new window has not any title or name. I have used ${window1} and ${window2} to select newly opened windows.${window1} and ${window2} are derived from "storeAttribute" command and this way every time, selenium will find targeted window.

1 comment:

  1. what is select window= null and how to handle this is java/webdriver ?

    ReplyDelete