public class daatadriven {
@Test(dataProvider="wordpressdata")
public void logintowordpress(String username,String password) throws InterruptedException
{
System.setProperty("webdriver.chrome.driver", "D:\\chromedriver_win32\\chrome\\chromedriver.exe");
String path = System.getenv("PATH");
System.out.println(path); // Should contain C:\Windows\system32
WebDriver driver = new ChromeDriver();
//driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
driver.get("http://demosite.center/wordpress/wp-login.php");
driver.findElement(By.id("user_login")).sendKeys("");
driver.findElement(By.id("user_pass")).sendKeys("");
driver.findElement(By.id("wp-submit")).click();
Thread.sleep(5000);
System.out.println(driver.getTitle());
driver.quit();
//driver.close();
}
@DataProvider(name="wordpressdata")
public Object passData()
{
Object[][] data= new Object[3][2];
data[0][0]=" ";
data[0][1]=" ";
data[1][0]=" ";
data[1][1]=" ";
data[2][0]=" ";
data[2][1]=" ";
return data
}
}
我的代码显示以下错误:
org.openqa.selenium.os.ProcessUtils killWinProcess 警告:过程在10秒后拒绝死亡,并且无法完成任务 java.lang.NullPointerException:无法找到:taskkill
的可执行文件根据谷歌我试图设置c:\ windows \ system32环境变量 但仍然得到同样的错误
答案 0 :(得分:0)
尝试使用driver.close()代替driver.quit()并检查