selenium测试(Java)-- 验证信息(八)
1 package com.test.validationinfor; 2 3 import org.openqa.selenium.WebDriver; 4 import org.openqa.selenium.firefox.FirefoxDriver; 5 6 public class ValidationInformation { 7 8 public static void main(String[] args) { 9 10 11 WebDriver driver = new FirefoxDriver(); 12 driver.get("http://www.baidu.com"); 13 driver.manage().window().maximize(); 14 15 16 System.out.println("CurrentUrl: "+driver.getCurrentUrl()); 17 18 //System.out.println("PageSource: "+driver.getPageSource()); 19 20 System.out.println("Title: "+driver.getTitle()); 21 22 System.out.println("WindowHandle: "+driver.getWindowHandle()); 23 24 System.out.println("hashCode: "+driver.hashCode()); 25 26 driver.quit(); 27 28 } 29 30 }
运行结果:
CurrentUrl: https://www.baidu.com/
Title: 百度一下,你就知道
WindowHandle: {faa8c575-8918-457c-9765-0c227def08f4}
hashCode: 112302969
本文来自博客园,作者:月色深潭,交流群:733423266,转载请注明原文链接:https://www.cnblogs.com/moonpool/p/5668511.html