Hey there! any question in your mind? Ask It Now!.

Popular Categories





How can i change focus to a new popup in Selenium?

+7 votes
575 views
asked in Software Testing by Jens

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
answered by seleniumGuru Expert (4,570 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
answered by yakup yazıcı
edited by Bhartesh

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!

Related Questions

+2 votes
1 answer 1,316 views
+1 vote
1 answer 557 views
+1 vote
1 answer 2,274 views
+5 votes
7 answers 14,684 views
+2 votes
1 answer 148 views
+2 votes
2 answers 839 views

Not a Member yet?

Ask to Folks Login

My Account
621 Folks are online
2 members and 619 guest online
Your feedback is highly appreciated