标签:out quit forward output action 分享 screens drive nbsp
public static void testBrowser(WebDriver driver) throws Exception { driver.get("http://www.cnblogs.com/tankxiao"); Thread.sleep(5000); // 浏览器最大化 driver.manage().window().maximize(); driver.navigate().to("http://www.baidu.com"); // 刷新浏览器 driver.navigate().refresh(); // 浏览器后退 driver.navigate().back(); // 浏览器前进 driver.navigate().forward(); // 浏览器退出 driver.quit(); }
public static void testScreenShot(WebDriver driver) throws Exception { driver.get("http://www.baidu.com"); File srcFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); FileUtils.copyFile(srcFile, new File("c:\\1.png")); }
public static void rightClickMouse(WebDriver driver) { driver.get("http://www.baidu.com"); Actions action = new Actions(driver); action.contextClick(driver.findElement(By.id("kw"))).perform(); }
public static void killProcess() { // kill firefox WindowsUtils.tryToKillByName("firefox.exe"); // kill IE WindowsUtils.tryToKillByName("iexplore.exe"); // kill chrome WindowsUtils.tryToKillByName("chrome.exe"); }
标签:out quit forward output action 分享 screens drive nbsp
原文地址:http://www.cnblogs.com/MarchThree/p/7258120.html