Jenkins:WebDriver连接被拒绝(Firefox)/ Chrome无法启动:崩溃(Chrome)

时间:2018-03-21 19:32:27

标签: java selenium jenkins

硒测试。 当我从IDE运行测试时,一切都完美无缺。 但是与Jenkins一起运行会有问题。

[ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 11, Time elapsed: 66.516 s <<< FAILURE! - in TestSuite
[ERROR] beforeClass(TestsSignUpPage.RequiredFields)  Time elapsed: 66.136 s  <<< FAILURE!
org.openqa.selenium.WebDriverException: 
connection refused
你能帮帮我吗? 运行firefox或chrome驱动程序时遇到同样的问题。

这是控制台输出:

[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for Gmail:gmail:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.groovy:groovy:jar -> duplicate declaration of version 1.8.3 @ line 63, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.groovy:groovy:jar -> duplicate declaration of version 1.8.3 @ line 68, column 21
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.codehaus.groovy:groovy:jar -> duplicate declaration of version 1.8.3 @ line 73, column 21
[WARNING] 'dependencies.dependency.version' for org.testng:testng:jar is either LATEST or RELEASE (both of them are being deprecated) @ line 82, column 22
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO] 
[INFO] ----------------------------< Gmail:gmail >-----------------------------
[INFO] Building gmail 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.pom (32 kB at 27 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.pom (632 B at 8.2 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.pom (264 B at 3.6 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-parent/3.2/asm-parent-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-parent/3.2/asm-parent-3.2.pom (4.4 kB at 48 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.pom (415 B at 5.8 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.pom (404 B at 5.3 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.pom (409 B at 5.3 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.pom
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.pom (417 B at 5.1 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.jar
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-commons/3.2/asm-commons-3.2.jar (33 kB at 71 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-util/3.2/asm-util-3.2.jar (37 kB at 76 kB/s)
[INFO] Downloading from central: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.jar
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm/3.2/asm-3.2.jar (43 kB at 85 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-tree/3.2/asm-tree-3.2.jar (22 kB at 36 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/asm/asm-analysis/3.2/asm-analysis-3.2.jar (18 kB at 30 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/antlr/antlr/2.7.7/antlr-2.7.7.jar (445 kB at 272 kB/s)
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/groovy/groovy/1.8.3/groovy-1.8.3.jar (5.5 MB at 253 kB/s)
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ gmail ---
[INFO] Deleting /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ gmail ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Shared/Jenkins/Home/workspace/GmailGitHub/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ gmail ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ gmail ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/Shared/Jenkins/Home/workspace/GmailGitHub/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ gmail ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 3 source files to /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.21.0:test (default-test) @ gmail ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running TestSuite
1521659923546   geckodriver INFO    geckodriver 0.19.1
1521659923561   geckodriver INFO    Listening on 127.0.0.1:37123
1521659925609   mozrunner::runner   INFO    Running command: "/Applications/Firefox.app/Contents/MacOS/firefox-bin" "-marionette" "-profile" "/var/folders/55/cb16fw2903l_bbx9l9vx_9d800007q/T/rust_mozprofile.Y4QTxY9GXv22"
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
1521659927038   Marionette  INFO    Enabled via --marionette
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2018-03-21 12:18:49.139 plugin-container[808:114493] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8247, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
_RegisterApplication(), FAILED TO establish the default connection to the WindowServer, _CGSDefaultConnection() is NULL.
2018-03-21 12:18:50.674 plugin-container[811:114806] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x8023, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2018-03-21 12:18:54.095 plugin-container[808:114493] In -[NSApplication(NSQuietSafeQuit) _updateCanQuitQuietlyAndSafely], _LSSetApplicationInformationItem(NSCanQuitQuietlyAndSafely) returned error -600
[ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 11, Time elapsed: 66.516 s <<< FAILURE! - in TestSuite
[ERROR] beforeClass(TestsSignUpPage.RequiredFields)  Time elapsed: 66.136 s  <<< FAILURE!
org.openqa.selenium.WebDriverException: 
connection refused
Build info: version: '3.10.0', revision: '176b4a9', time: '2018-03-02T19:03:16.397Z'
System info: host: 'Auznali.internet.sony.tv', ip: 'fe80:0:0:0:2acf:e9ff:fe50:9c01%en0', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.10.5', java.version: '1.8.0_162'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
   0:        0x10583749e - backtrace::backtrace::trace::h3ab5720c483fe461
   1:        0x1058374dc - backtrace::capture::Backtrace::new::h096accf58447e0d5
   2:        0x105770534 - webdriver::error::WebDriverError::new::hc0958d01acda7bfc
   3:        0x105777300 - geckodriver::marionette::MarionetteHandler::create_connection::h59a68c8dfef48e54
   4:        0x105756d3c - _$LT$webdriver..server..Dispatcher$LT$T$C$$u20$U$GT$$GT$::run::h5a26ba0bb4fdb139
   5:        0x10572f0c5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h3f868f7a1a12bdcc
   6:        0x105739d2d - std::panicking::try::do_call::hfce1ad2a948c3632
   7:        0x1058e3a5c - __rust_maybe_catch_panic
   8:        0x10574ceb5 - _$LT$F$u20$as$u20$alloc..boxed..FnBox$LT$A$GT$$GT$::call_box::h651dedb755194a8c
   9:        0x1058dfc4b - std::sys::imp::thread::Thread::new::thread_start::h48c72bb09587cbc3
  10:     0x7fff89e4e059 - _pthread_body
  11:     0x7fff89e4dfd6 - _pthread_start
    at TestsSignUpPage.RequiredFields.beforeClass(RequiredFields.java:49)

[INFO] 
[INFO] Results:
[INFO] 
[ERROR] Failures: 
[ERROR]   RequiredFields.beforeClass:49 » WebDriver connection refused
Build info: versi...
[INFO] 
[ERROR] Tests run: 12, Failures: 1, Errors: 0, Skipped: 11
[INFO] 
[ERROR] There are test failures.

Please refer to /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[JENKINS] Recording test results
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ gmail ---
[INFO] Building jar: /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target/gmail-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:42 min
[INFO] Finished at: 2018-03-21T12:19:53-07:00
[INFO] ------------------------------------------------------------------------
Ожидаю пока Jenkins закончит сбор данных
[JENKINS] Archiving /Users/Shared/Jenkins/Home/workspace/GmailGitHub/pom.xml to Gmail/gmail/1.0-SNAPSHOT/gmail-1.0-SNAPSHOT.pom
[JENKINS] Archiving /Users/Shared/Jenkins/Home/workspace/GmailGitHub/target/gmail-1.0-SNAPSHOT.jar to Gmail/gmail/1.0-SNAPSHOT/gmail-1.0-SNAPSHOT.jar
channel stopped
Finished: UNSTABLE

如果您需要附加信息,请告诉我

1 个答案:

答案 0 :(得分:0)

我得到了解决方案:https://medium.com/@ved.pandey/setting-up-jenkins-on-mac-osx-50d8fe16df9f

Jenkins创建了新用户。 需要授予该用户管理员权限,更改密码,以该用户身份登录。