1 上面是谷歌浏览器和chromedriver版本
2下面是代码 , 浏览器打开后,网站不能正常打开,控制台报空指针异常
packagePDWYPT;
importstaticorg.junit.Assert.*;
importorg.junit.After;
importorg.junit.Before;
importorg.junit.Test;
importorg.openqa.selenium.By;
importorg.openqa.selenium.WebDriver;
importorg.openqa.selenium.chrome.ChromeDriver;
publicclassSHUAXIN{
WebDriverdriver;
//privateWebDriverdriver;
@Before
publicvoidsetUp()throwsException{
System.setProperty("webdriver.chrome.driver","E:\\chromedriver.exe");
//初始化一个谷歌浏览器名称为driver
WebDriverdriver=newChromeDriver();
//窗口最大化
driver.manage().window().maximize();
}
@After
publicvoidtearDown()throwsException{
driver.quit();
}
@Test
publicvoidtest()throwsInterruptedException{
driver.get("https://XXXX/AXXX/fron22t/index.jsp");
for(inti=0;i<=200;i++){
driver.findElement(By.linkText("云设计")).click();
//for(inti=0;i<=200;i++){
driver.findElement(By.className("shang")).click();
driver.findElement(By.linkText("云设计")).click();
Thread.sleep(3000);
}
}