MCKiran
MCKiran

Reputation: 57

How to handle a new window tab in selenium IDE?

I was trying to automate searching jobs in Naukri. when I do a search by category, it opens the window in a new Tab.

That window is served by a link, ex:

< a href="Naukri.com/jobs-by-cat">Jobs By Category < /a > 

Now how can I make selenium execute the remaining commands in that new window?

Upvotes: 0

Views: 10297

Answers (4)

ThamDH
ThamDH

Reputation: 1

You can use this:

command: storeElementPresent
Target: link=... (or use id. Ex: company-id=2258)
Value: url <br/>

THEN:

command: open
Target: url
Value: url (or null)

Upvotes: 0

MCKiran
MCKiran

Reputation: 57

I didnt find any direct solution for this but I discovered a workaround. I actually copied the href attribute value of the < a> tag by the command "storeAttribute" and used a "open" command to open that url in the same window avoiding it to be opned in a new window.

I used it to automate Naukri job search :

Here is the code:

storeAttribute | link=Hotel Jobs@href | url <br/> 
open | ${url}

Upvotes: 0

Karunagara Pandi
Karunagara Pandi

Reputation: 644

I found the solution and it is working for me..... :)

And here are the scripts that I have used for my testing...

Line No: 1

Command: storeAttribute
Target: link=https://yourwebaddress.net/vmrc/onboard.do@href
Value: testurl ( i.e. variable name )

Line No: 2

Command: open
Target: ${testurl}

Upvotes: 0

Buddha
Buddha

Reputation: 4476

You will have to use waitForPopUp and then selectPopUp to switch focus to the new tab.

Then all your operations will be performed on new tab or window. Once you are done using close will close the newly opened window and use selectWindow again to select your original window.

If this doesn't work, see if you can move to Webdriver because there are many more limitations for Selenium IDE.

Upvotes: 1

Related Questions