driver = new ChromeDriver(); driver.manage().window().maximize(); baseUrl = "http://www.google.co.uk/"; driver.get(baseUrl); driver.findElement(By.cssSelector("body")).sendKeys(Keys.ConTROL +"t"); ArrayList<String> tabs = new ArrayList<String> (driver.getWindowHandles()); driver.switchTo().window(tabs.get(1)); //switches to new tab driver.get("https://www.facebook.com"); driver.switchTo().window(tabs.get(0)); // switch back to main screen driver.get("https://www.news.google.com");
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)