小编Gri*_*wal的帖子

Selenium WebDriver RuntimeException:进程在10秒后拒绝死亡,并且无法执行任务:无法找到可执行文件:taskkill

  public class Second {
  private WebDriver driver;
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @BeforeClass
  public void beforeClass() {
  driver = new FirefoxDriver();
  driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
  driver.manage().window().maximize();
  }


 @Test
  public void testSecond() throws Exception {
  driver.get("url");
  System.out.println("test two");
  Thread.sleep(5000);

 }

 @AfterClass
 public void afterClass() throws Exception{
  driver.quit();
    String verificationErrorString = verificationErrors.toString();
    if (!"".equals(verificationErrorString)) {
      fail(verificationErrorString);
    }
 }
}
Run Code Online (Sandbox Code Playgroud)

这是一个testNG测试用例,它会在driver.quit()中抛出Runtime Exception.测试成功通过但测试完成后浏览器未关闭
Stack Trace:

 FAILED CONFIGURATION: @AfterTest afterClass
java.lang.RuntimeException: Process refused to die after 10 seconds, and couldn't taskkill …
Run Code Online (Sandbox Code Playgroud)

java testng selenium-webdriver

7
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×1

selenium-webdriver ×1

testng ×1