package test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class webpage {
@Test
public void test() throws InterruptedException{
System.setProperty(“webdriver.chrome.driver”, “D:/01 Learn WebDriver/chromedriver.exe”);
WebDriver dr = new ChromeDriver();
dr.manage().window().maximize();
dr.get(“http://www.baidu.com”);
//如果有重定向,可以等几秒之后再打印
System.out.println(“The Title is:”+dr.getTitle());
System.out.println(“Current URL is:”+dr.getCurrentUrl());
Thread.sleep(3000);
dr.quit();
}
}
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/191125.html