selenium測試(Java)-- 驗證信息(八)
阿新 • • 發佈:2017-08-05
shc imp tle java style code spa aid pack
package com.test.validationinfor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class ValidationInformation { public static void main(String[] args) { WebDriver driver = new FirefoxDriver(); driver.get("http://www.baidu.com"); driver.manage().window().maximize(); System.out.println("CurrentUrl: "+driver.getCurrentUrl()); //System.out.println("PageSource: "+driver.getPageSource()); System.out.println("Title: "+driver.getTitle()); System.out.println("WindowHandle: "+driver.getWindowHandle()); System.out.println("hashCode: "+driver.hashCode()); driver.quit(); } }
運行結果:
CurrentUrl: https://www.baidu.com/
Title: 百度一下,你就知道
WindowHandle: {faa8c575-8918-457c-9765-0c227def08f4}
hashCode: 112302969
selenium測試(Java)-- 驗證信息(八)