unable to switch to ‘current active tab’ in chrome using webdriver in java

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<String> allWindowHandles = driver.getWindowHandles();
for (String windowHandle : allWindowHandles) {
if (!windowHandle.equals(<cannot get the active window handle>)) {
However getting the current active tab handle is the issue.

mnsam Default Asked on March 13, 2016 in Selenium WebDriver.
Add Comment
0 Answer(s)

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.