关闭子选项卡后驱动程序失去焦点,无法在父选项卡上执行任何操作

时间:2016-06-01 07:03:20

标签: java selenium

我的代码就像这样

//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);
        }

现在我的驱动程序没有专注于旧标签。它只在旧选项卡上等待并且不执行任何操作。如何让驱动程序专注于旧标签?

0 个答案:

没有答案