package org.coderinfo.demo;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class GetWebSiteAndPrintWebInfo {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
driver.manage().window().maximize(); //最大化浏览器界面
driver.get(URL); // 等同于 driver.navigate().to(URL); 访问谷哥的首页 ,此处放弃度娘。
String title = driver.getTitle(); //获取当前页面的title
String currentUrl = driver.getCurrentUrl(); // 获取当前页面的URL
System.out.printf("Current page's title is: %s , Current URL is: %s \n",title,currentUrl);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
driver.quit(); //彻底退出WebDriver
}
}