+7 votes
883 views
in Software Testing by

I'm using Selenium and Firefox.

I have a link on a page (say linkA) that opens a new page in a new tab. The new tab is displayed when linkA is clicked. I then want to interact with the new page

Selenium cannot identify the new tab. It reports:

[warn] Link has target '_blank', which is not supported in Selenium! Randomizing target to be: selenium_blank24003

Is there any way to tell Selenium to interact with the displayed tab?

2 Answers

0 votes
by Expert (4.6k points)

you can try this

Webdriver driver = new FirefoxDriver();

driver .switchTo.window("Window name here"); \\by this you can go to new window 

you have to use this  code when your script opens a new window after click on that link ,

now you are in new window and can access the elements of new window.

0 votes
by
edited by

You can use switchTo() function in webdriver to switch other page or frame.

You can use index to switch.This int is a 0 based index of the windows available. The first window would be 0, the second 1 and so on.

It may help you!

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated