eclipse 关于 destroyHarder 的 Selenium Webdriver 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24322540/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:45:29  来源:igfitidea点击:

Selenium Webdriver Error regarding destroyHarder

eclipseselenium

提问by Saravana

What kind of error is the below one. This occurs when I execute the webdriver script in eclipse:

下面那个是什么错误。当我在 eclipse 中执行 webdriver 脚本时会发生这种情况:

Jun 20, 2014 1:20:54 PM org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder INFO: Command failed to close cleanly. Destroying forcefully (v2). org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@118ed3c

2014 年 6 月 20 日下午 1:20:54 org.openqa.selenium.os.UnixProcess$SeleniumWatchDog destroyHarder 信息:命令无法完全关闭。强行破坏(v2)。org.openqa.selenium.os.UnixProcess$SeleniumWatchDog@118ed3c

回答by Babulu

This is a bug. I think you have to downgrade your firefox to 29, if you are using firefox 30.

这是一个错误。如果您使用的是 Firefox 30,我认为您必须将您的 Firefox 降级到 29。

Please find the below url for moreinformation

请找到以下网址以获取更多信息

https://code.google.com/p/selenium/issues/detail?id=7506

https://code.google.com/p/selenium/issues/detail?id=7506

回答by TEH EMPRAH

I'm facing this problem in one test project out of four.

我在四个测试项目中的一个中面临这个问题。

Initial investigation led me to conclusion that this happens when trying to quit firefox while page is still loading (the green circle in tab)

初步调查使我得出结论,当页面仍在加载时尝试退出 Firefox 时会发生这种情况(选项卡中的绿色圆圈)

If you use Java you can try the following:

如果您使用 Java,您可以尝试以下操作:

ExpectedCondition<Boolean> pageLoadFinishedCondition = new ExpectedCondition<Boolean>() {
        public Boolean apply(WebDriver driver) {
            return ((JavascriptExecutor) driver).executeScript(
                    "return document.readyState").equals("complete");
        }
    };

WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(pageLoadFinishedCondition);

UPD:

更新:

But be advised that 'document is ready' event happens slightly before firefox stops that green circle, so you may need to idle a bit.

但请注意,在 Firefox 停止那个绿色圆圈之前,“文档准备好”事件会稍微发生,因此您可能需要稍作休息。

Further investigation showed that this is highly dependent on the application itself (And in my case, did not work) E.g. when being on login page of the application, I could not exit, while being on dashboard everything was just fine.

进一步调查表明,这高度依赖于应用程序本身(在我的情况下,不起作用)例如,在应用程序的登录页面上时,我无法退出,而在仪表板上一切都很好。

I suggest you try the following:

我建议您尝试以下操作:

  1. Downgrade to Firefox <30 (problem persists in 33)
  2. Quit while being on another page of the application (invent some stub here)
  3. Make driver.navigate().refresh();or something like this.
  4. Giant idling before quit() sometimes helps, say, 2*implicitlywait
  1. 降级到 Firefox <30(问题在 33 中仍然存在)
  2. 在应用程序的另一个页面上退出(在这里发明一些存根)
  3. 制作driver.navigate().refresh();或类似的东西。
  4. 退出()之前的巨大空闲有时会有所帮助,例如 2*implicitlywait

UPD:

更新:

  1. Also, deleting plugin-container.exemight help. Note that after I deleted one, flash wasn't loading into my page any longer.
  1. 此外,删除plugin-container.exe可能会有所帮助。请注意,在我删除一个之后,Flash 不再加载到我的页面中。

回答by lionxlamb

I'm also facing the same problem since I upgraded to Firefox.Seems like a plugin compatibility error with Firefox Plugin.I'm not sure if it downgrading will help.

自从我升级到 Firefox 后,我也面临同样的问题。似乎是 Firefox 插件的插件兼容性错误。我不确定降级是否有帮助。

But I removed driver.quit(); from my code as I didn't want the browser to close even after execution of the script.This stopped the errors.

但我删除了 driver.quit(); 来自我的代码,因为即使在执行脚本后我也不希望浏览器关闭。这停止了错误。

回答by Mariamj

Add a try catch block in your Test annotation.

在您的 Test 注释中添加一个 try catch 块。

try {
    Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}

or you can try this too

或者你也可以试试这个

try{
driver.close();
}
} catch (InterruptedException e) {
e.printStackTrace();
}

in After annotation.

在注解之后。

It should solve the problem.

它应该可以解决问题。

回答by mary

instead of simply

而不是简单地

driver.quit();

use:

用:

driver.close();

try {
Thread.sleep(5000);
driver.quit();
} catch (Exception e) {
}

回答by Peter Xie

This works for me, interesting. But it applies to the case that you open only one browser when close() is the same as quit().

这对我有用,很有趣。但它适用于 close() 与 quit() 相同时只打开一个浏览器的情况。

    driver.close();
    try {
        Thread.sleep(1000);
        //driver.quit();
    } catch (Exception e) {
    }