我试图在竹子服务器上运行一些Selenium测试,使用Xvfb模拟显示器。
这些测试适用于ChromeDriver和phantomJS,但它在Firefox中崩溃了:
Forking command line: /bin/sh -c cd /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1 && /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -jar /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefirebooter1260921380504465598.jar /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefire4923082243141341705tmp /usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/target/surefire/surefire_04348841300974089213tmp
Running com.lazerycode.selenium.tests.GoogleExampleIT
Configuring TestNG with: TestNG60Configurator
Current Operating System: LINUX
Current Architecture: amd64
Current Browser Selection: FIREFOX
1495535703540 geckodriver INFO Listening on 127.0.0.1:17068
1495535704705 geckodriver::marionette INFO Starting browser /usr/lib/firefox/firefox.sh with args ["-marionette"]
1495535709415 Marionette INFO Listening on port 39935
1495535709539 Marionette WARN TLS certificate errors will be ignored for this session
mai 23, 2017 12:35:10 PM org.openqa.selenium.remote.ProtocolHandshake createSession
INFOS: Detected dialect: W3C
mai 23, 2017 12:35:12 PM org.openqa.selenium.os.UnixProcess destroy
INFOS: Command failed to close cleanly. Destroying forcefully (v2). [/usr/local/bamboo/BAMBOO/xml-data/build-dir/SL-SL-JOB1/src/test/resources/selenium_standalone_binaries/linux/marionette/64bit/geckodriver, --port=17068][ {}]
mai 23, 2017 12:35:13 PM org.openqa.selenium.os.UnixProcess destroy
GRAVE: Unable to kill process with PID 4042
Tests run: 5, Failures: 2, Errors: 0, Skipped: 3, Time elapsed: 11.775 sec <<< FAILURE! - in com.lazerycode.selenium.tests.GoogleExampleIT
setup(com.lazerycode.selenium.tests.GoogleExampleIT) Time elapsed: 11.021 sec <<< FAILURE!
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'vps409374', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.3cTlgJI5I9iE, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=53.0.2, platformVersion=4.4.0-78-generic, moz:processID=4050.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
Session ID: 329b5087-5597-478b-9dac-6472c5490aee
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:17068 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at com.lazerycode.selenium.tests.GoogleExampleIT.setup(GoogleExampleIT.java:21)
closeDriverObjects(com.lazerycode.selenium.tests.GoogleExampleIT) Time elapsed: 11.605 sec <<< FAILURE!
org.openqa.selenium.remote.UnreachableBrowserException:
Error communicating with the remote browser. It may have died.
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'vps409374', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-78-generic', java.version: '1.8.0_131'
Driver info: driver.version: RemoteWebDriver
Capabilities [{moz:profile=/tmp/rust_mozprofile.3cTlgJI5I9iE, rotatable=false, timeouts={implicit=0.0, pageLoad=300000.0, script=30000.0}, pageLoadStrategy=normal, platform=ANY, specificationLevel=0.0, moz:accessibilityChecks=false, acceptInsecureCerts=true, browserVersion=53.0.2, platformVersion=4.4.0-78-generic, moz:processID=4050.0, browserName=firefox, javascriptEnabled=true, platformName=linux}]
Session ID: 329b5087-5597-478b-9dac-6472c5490aee
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:17068 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
Results :
Failed tests:
GoogleExampleIT>DriverBase.closeDriverObjects:43 » UnreachableBrowser Error co...
GoogleExampleIT.setup:21 » UnreachableBrowser Error communicating with the rem...
Tests run: 5, Failures: 2, Errors: 0, Skipped: 3
您可以在github上找到所有测试代码:https://github.com/Joel-Costamagna/Selenium-Maven-Template
答案 0 :(得分:0)
似乎Firefox
和GeckoDriver
的版本彼此不匹配,请检查版本的兼容性。
您还可以尝试使用可从cordova - Error: Failed to fetch platform android下载的GeckoDriver
的最新版本。