how to change the focus to the new tab with in the same browser

Can anyone send me the piece of code how to change the webdriver focus to the new tab with in the same browser

swapnad Default Asked on August 31, 2016 in Selenium WebDriver.
Add Comment
1 Answer(s)

i think u ask for window handles

String parentWindow=wb.getWindowHandle();
Set handles=wb.getWindowHandles();
for(String handle1:wb.getWindowHandles()){
wb.switchTo().window(handle1);
}

//do operation in this window
//switch back to parent window

wb.switchTo().window(parentWindow);

vinaypawar77 Default Answered on September 1, 2016.
Add Comment

Your Answer

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