Tag: window handles

getWindowHandles()在firefox 58中不起作用。焦点仍然在父选项卡上,并且不会转移到下一个选项卡

我开始学习如何使用Selenium和Java在浏览器中处理多个选项卡。 看起来我的代码不起作用。 import java.util.ArrayList; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver; public class HandlingWindows { public static void main(String[] args) throws InterruptedException { WebDriver driver= new FirefoxDriver(); driver.get(“https://www.facebook.com/”); String parent= driver.getWindowHandle(); System.out.println(“Parent Window is”+parent); //Get Data Policy WebElement we= driver.findElement(By.linkText(“Data Policy”)); //Click Data Policy link we.click(); //Create an arrayList ArrayList s1= new ArrayList(driver.getWindowHandles()); for(String […]