以下代码在Chrome中正常运行但在Firefox和IE中无效
public static Object[] switchToAnotherWindow()
{
Set<String> windows=SeleniumMethods.getDriver().getWindowHandles();
Object[] window=windows.toArray();
SeleniumMethods.getDriver().switchTo().window((String) window[(windows.size()-1)]);
System.out.println("windows"+windows.toString());
System.out.println("switched to Another window"+(windows.size()-1));
SeleniumMethods.getLogger().log(LogStatus.INFO, "Switcing to Last Opened/Another window");
return window;
}
public static void switchtoRequiredWindow(Object[] windows,int window)
{
SeleniumMethods.getDriver().switchTo().window((String) windows[window]);
System.out.println("windows"+windows[window]);
System.out.println("switched to Original window"+window);
SeleniumMethods.getLogger().log(LogStatus.INFO, "Switching to Required window"+window);
}
当我调用像public static void switchtoRequiredWindow(0)
这样的方法时,它没有切换到原始窗口。你能建议我在Firefox和IE中工作吗?