I want to switch between 2 tabs of browser. Currently tried of getting number of window handles, but even though 2 tabs are open its shows as 1.
Asked
Active
Viewed 2,203 times
1
-
possible duplicate of [SO Ques](http://stackoverflow.com/questions/28165193/opening-a-new-tab-in-the-same-window-session-of-the-browser-through-selenium-web) – Vivek Singh Jan 27 '15 at 12:23
-
@VivekSingh - I do not think it is duplicate. can you please re check? Link which you have shared has answer to open link in new tab. – Helping Hands Jan 27 '15 at 12:34
-
@Suyog - Please refer this answer : http://stackoverflow.com/questions/11358316/selenium-web-driver-open-new-tab-instead-of-a-new-window/11358741#11358741 – Helping Hands Jan 27 '15 at 12:35
2 Answers
1
You never mentioned any language
you are using. But, I use the following to handle some of my tests
Driver.SwitchTo().Window(Driver.WindowHandles.LastOrDefault());
Mine is C# but it would be pretty simple to convert.

Saifur
- 16,081
- 6
- 49
- 73
1
Selenium can get windowhandles of those tabs whose origin is same.... if the web application origin is different then you'll not get window handle
If its from same origin then this issue may come in Internet Explorer 9- I have come across this issue before in IE Browser..
You may also want to refer your company's security policy .. maybe it can be the cause to detach second window from the parent window....

sunder kandasamy
- 190
- 8