问题描述
在 webdriver 独立服务器中运行自动化时,我随机收到此异常.一旦它来了,我就杀死了所有的 java 进程.那么这个异常的解决方案是什么?为什么它随机出现?
While running automation in webdriver standalone server, i get this exception randomly. Once it comes, I killed all java process . So what is the solution for this exception ? Why it comes randomly ?
不幸的是,据我所知,所有人都建议使用最新版本的 selenium jar 或根据 selenium 版本来兼容的 firefox 版本,或者他们说要检查该端口是否正在使用(尽管它不会!)或重新启动系统.很少有人建议卸载firefox版本并重新安装它.任何永久解决方案或任何想法为什么会出现?
Unfortunately as far as i know, all have suggested to use latest version of selenium jar or come compatible firefox version depending on the selenium version or they have said to check if that port is on use (though it won't!) or reboot system.Few have suggested to uninstall firefox version and reinstall it. Any permanent solution or any idea why it comes?
org.openqa.selenium.WebDriverException: Unable to bind to locking port 7054 within 45000 ms
Build info: version: '2.30.0', revision: 'dc1ef9c', time: '2013-02-19 00:15:27'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0'
Driver info: driver.version: FirefoxDriver
Command duration or timeout: 47.94 seconds
Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 15:53:30'
System info: os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.7.0'
Driver info: org.openqa.selenium.remote.RemoteWebDriver
推荐答案
似乎以前的 webDriver 实例(或其他东西)没有释放端口.这是此问题 (Java) 的解决方法(不良做法):
Seems like previous webDriver instance (or something else) didn't release the port. Here is workaround (bad practice) for this problem (Java):
public static FirefoxBrowser forceInit() {
try {
return new FirefoxBrowser();
} catch (WebDriverException exc) {
return forceInit();
}
}
通过以下方式确保您的测试正确关闭驱动程序:
Make sure your tests close driver correctly by:
driver.quit();
这篇关于无法在 45000 毫秒内绑定到锁定端口 7054的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!