// Mooctest Selenium Example // <!> Check if selenium-standalone.jar is added to build path.
public static void test(WebDriver driver) throws InterruptedException { try { Thread.sleep(6000); // 等待6s,待应用完全启动 } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } driver.manage().timeouts().implicitlyWait(8, TimeUnit.SECONDS); // // 设置尝试定位控件的最长时间为8s,也就是最多尝试8s // TODO Test script System.out.println("前往登录页"); driver.get("http://114.116.106.156/show-how/user/my-info-input.do"); driver.manage().window().maximize();
}
public static void main(String[] args) { // Run main function to test your script. ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setBinary("D:\\Tencent\\QQBrowser\\QQBrowser.exe"); // QQBrowser安装路径 System.setProperty("webdriver.chrome.driver", "D:\\Tencent\\QQBrowser\\chromedriver.exe"); WebDriver driver = new ChromeDriver(chromeOptions);