I currently have a Java application using Selenium Webdriver and google chrome. There is a lot of cases in which the user will be switching back and forth between tabs. I'm trying to get the program to identify the selected tab by the user, and switch the drivers focus to that tab. Currently the code only runs on whatever tab is focused on, regardless of what the user switches it to. I understand to switch the focus I can use
driver.switchTo().window(currentTab);
However, I can't seem to figure out what the current tab index is. I would like to avoid using the "tabs" extension from google chrome. I've found a few online posts about this subject but none have seem to have a solution. Any help would be appreciated.