![]() ![]() In this case using Ctrl \t (Ctrl Tab) to switch between tabs is more useful.ĭriver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL "t") ĭriver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL "\t") Hence switching between window handles keeps the control in the same tab. ![]() In case there are multiple tabs in the same window, then there is only one window handle. Use the list of window handles to switch between windowsĭriver.switchTo().window(mainWindowHandle) String windowHandle = driver.getWindowHandle() ĪrrayList tabs = new ArrayList (driver.getWindowHandles()) In case there are multiple windows, then the following code can help: //Get the current window handle ![]() There is a difference how web driver handles different windows and how it handles different tabs. It is possible to switch between individual tabs without having multiple browser instances. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |