我的代码就像这样
//Clicking on 'imageRepository' Button opens New Tab.
action.perform(imageRepository, Actions.Click, "",
"Click on Image repository button");
ElementsAction.callMeToWait(10000);
ArrayList<String> newTab = new ArrayList<String>(driver.getWindowHandles());
newTab.remove(oldTab);
// change focus to new tab
driver.switchTo().window(newTab.get(0));
selectImage(imageXml);
//After Selecting image Clicking on 'ImageRepositoryPageAddItemButton' closes the new opened tab and automatically gets back to old tab.
clickImageRepositoryPageAddItemButton();
//back to old tab
driver.switchTo().window(oldTab);
}
现在我的驱动程序没有专注于旧标签。它只在旧选项卡上等待并且不执行任何操作。如何让驱动程序专注于旧标签?