When I click on a link in my test, it opens a new tab. I want ChromeDriver to then focus on that tab. I have tried the following code to get ChromeDriver to change tabas using
In C# I used the below lines to switch between the two tab.
IJavaScriptExecutor js = (IJavaScriptExecutor)driver; js.ExecuteScript("window.open();"); IList tabs = new List(driver.WindowHandles); driver.SwitchTo().Window(tabs[1]); driver.Navigate().GoToUrl("http://www.google.com");