我正在使用下面的代码,使用下面的代码从一个选项卡切换到另一个选项卡。
appiumDriver.switchTo().window(childWindow);
Set<String> winHandles = driver.getWindowHandles();
// Loop through all handles
for(String handle: winHandles){
if(!handle.equals(parentHandle)){
driver.switchTo().window(handle);
答案 0 :(得分:0)
要在safari中切换标签而不是窗口句柄,我们需要使用getContexts(),下面是代码:
Set<String> contextView = (driver).getContextHandles();
ArrayList<String> s = new ArrayList<String>(contextView);
driver.context(s.get(contextView.size()-1));