Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
avatar
mnsam
Posts : 1
Join date : 2016-03-13

unable to switch to 'current active tab' in chrome using webdriver in java Empty unable to switch to 'current active tab' in chrome using webdriver in java

Sun Mar 13, 2016 3:41 pm
I am unable to switch to the 'current active tab' in Chrome using WebDriver. I have tried the following:
We can switch to tab, however we do not know which one is the current active tab

I have tried driver.switchTo().activeElement() however it is of no help
I have tried driver.switchTo().Window(""), doesn't work
Tried the following snippet.
Set allWindowHandles = driver.getWindowHandles();  
  for (String windowHandle : allWindowHandles) {
   if (!windowHandle.equals()) {
      driver.switchTo().window(windowHandle);
   }
}
However getting the current active tab handle is the issue.
avatar
murthi
Active particpant
Active particpant
Posts : 11
Join date : 2016-04-14
Location : Bangalore

unable to switch to 'current active tab' in chrome using webdriver in java Empty Re: unable to switch to 'current active tab' in chrome using webdriver in java

Thu Apr 14, 2016 8:05 pm
Normally there will be only one tab and if you click on a click, it may open the new window or it may open in the same browser as new tab.

To switch to new window, you can use driver.switchTo().window().

To switch to new tab, you can can you use send keys with Ctrl + Tab.

driver.findElement(By.xpath("/html/body")).sendKeys(keys.chrod(keys.Ctrl+Keys.TAB));

I have used one of my test case. It worked. You can tried this way.

Regards,
Murthi. S
avatar
vini546
Active particpant
Active particpant
Posts : 10
Join date : 2012-07-15
Location : Ahmedabad

unable to switch to 'current active tab' in chrome using webdriver in java Empty Re: unable to switch to 'current active tab' in chrome using webdriver in java

Thu May 12, 2016 8:50 pm
Thanks mate. I've tried and it's working perfect.

- Vinay
Sponsored content

unable to switch to 'current active tab' in chrome using webdriver in java Empty Re: unable to switch to 'current active tab' in chrome using webdriver in java

Back to top
Permissions in this forum:
You cannot reply to topics in this forum