为了清楚起见,如果我右键单击并在Eclipse中运行我的XML文件,Firefox将运行良好。但是,如果我试图从更改目录的.bat文件中运行完全相同的文件,我会得到以下错误:
Starting test in FireFox
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host 127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
efoxbrowserfeaturesfirefox@getpocket.com.xpi
1469730154261 addons.xpi DEBUG Calling bootstrap method startup on firefox@getpocket.com version 1.0.2
1469730154262 addons.xpi DEBUG Registering manifest for C:Program Files (x86)Mozilla Firefoxbrowserfeaturesloop@mozilla.org.xpi
1469730154263 addons.xpi DEBUG Calling bootstrap method startup on loop@mozilla.org version 1.3.2
1469730154277 addons.manager DEBUG Registering shutdown blocker for XPIProvider
1469730154278 addons.manager DEBUG Provider finished startup: XPIProvider
1469730154278 addons.manager DEBUG Starting provider: LightweightThemeManager
1469730154278 addons.manager DEBUG Registering shutdown blocker for LightweightThemeManager
1469730154278 addons.manager DEBUG Provider finished startup: LightweightThemeManager
1469730154278 addons.manager DEBUG Starting provider: GMPProvider
1469730154283 addons.manager DEBUG Registering shutdown blocker for GMPProvider
1469730154283 addons.manager DEBUG Provider finished startup: GMPProvider
1469730154283 addons.manager DEBUG Starting provider: PluginProvider
1469730154284 addons.manager DEBUG Registering shutdown blocker for PluginProvider
1469730154284 addons.manager DEBUG Provider finished startup: PluginProvider
1469730154284 addons.manager DEBUG Completed startup sequence
1469730155755 DeferredSave.extensions.json DEBUG Starting write
1469730155760 addons.manager DEBUG Starting provider: <unnamed-provider>
1469730155760 addons.manager DEBUG Registering shutdown blocker for <unnamed-provider>
1469730155761 addons.manager DEBUG Provider finished startup: <unnamed-provider>
JavaScript warning: resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/system/environment.js, line 15: Proxy.create and Proxy.createFunction are deprecated, use new Proxy instead
1469730156204 addons.repository DEBUG No addons.json found.
1469730156205 DeferredSave.addons.json DEBUG Save changes
1469730156207 DeferredSave.addons.json DEBUG Starting timer
1469730156221 addons.manager DEBUG Starting provider: PreviousExperimentProvider
1469730156221 addons.manager DEBUG Registering shutdown blocker for PreviousExperimentProvider
1469730156222 addons.manager DEBUG Provider finished startup: PreviousExperimentProvider
1469730156224 DeferredSave.extensions.json DEBUG Write succeeded
1469730156224 addons.xpi-utils DEBUG XPI Database saved, setting schema version preference to 17
1469730156267 DeferredSave.addons.json DEBUG Starting write
1469730156301 DeferredSave.addons.json DEBUG Write succeeded
console.error: all-aboard-v1:
Either no config.json file was created, or it was placed at the wrong location. Error:
Message: [Exception... "Component returned failure code: 0x80520012 (NS_ERROR_FILE_NOT_FOUND) [nsIChannel.open2]" nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)" location: "JS frame :: resource://gre/modul
这是我正在使用的bat文件:
set TEST=map_test.xml
cd C:seleniumproject
java -cp C:seleniumprojectlib*;C:seleniumprojectbin org.testng.TestNG %TEST%
set /p=Hit ENTER to continue...
我知道bat文件很好,因为在Chrome中一切都很好。我知道我的Firefox版本和Selenium都很好,因为它们都可以在Eclipse中工作,没有问题。它只是试图从命令行访问Firefox,问题就在这里。我仔细检查了我的图书馆,一切看起来都很正常。
我唯一能想到的是ChromeDriver在这里没有问题,因为它在系统属性中明确定义了位置,而as firefox只是在Selenium中默认定义的。
有什么想法吗?
Firefox驱动程序包含在selenium-server-stanalone.jar文件中。我想这个jar不是C:\selenium\project\lib\文件夹的一部分。
请下载兼容的并尝试运行它。
希望这能帮助。。。
我发现了问题。我运行的是带有Selenium 2.52.0的Firefox 47.0.1。这在EclipseIDE中有效,但由于某些原因,不能从命令提示符或.bat文件中执行。我唯一改变的是将Firefox降级到46.0.1。我甚至尝试了47.0.1 32位和64位,但没有成功。降级就是解决这个问题的办法。
感谢大家的建议!