TestNG:org.openqa.selenium.os.UnixProcess$SeleniumWatchDog错误

   在TestNG运行自动化测试用例的时候,浏览器FireFox正确打开,可是在测试用例运行完成后,我调用的是webdriver.quit()关闭程序的,结果却报以下错误:

   Sep 25, 2014 4:19:32 PM org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder
INFO: Command failed to close cleanly. Destroying forcefully (v2).  org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@e3226

关闭不太成功啊,还弹出了个对话框,提示关闭程序。在网上搜了一下,有如下三个方法可以解决:

1. Downgrade your FF version. 降低Firefox的版本

2. Delete plugin-container.exe from C:Program FilesMozilla Firefoxplugin-container.exe.

   删除plugin-container.exe文件

3. Use the code below 添加以下函数

public void closeBrowserSession() throws IOException {
Runtime.getRuntime().exec(“taskkill /F /IM chrome.exe”);
Runtime.getRuntime().exec(“taskkill /F /IM iexplorer.exe”);
Runtime.getRuntime().exec(“taskkill /F /IM firefox.exe”);
}

This will run on windows only.

为了省事,我用的是第二个方法,删除了plugin-container.exe文件,再次运行成功!!

----夫英雄者,胸怀大志,腹有良谋,有包藏宇宙之机,吞吐天地之志者也。
原文地址:https://www.cnblogs.com/eagleking0318/p/6520914.html