Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/jenkins/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在云上使用jenkins运行selenium测试时出错_Jenkins_Selenium Webdriver - Fatal编程技术网

在云上使用jenkins运行selenium测试时出错

在云上使用jenkins运行selenium测试时出错,jenkins,selenium-webdriver,Jenkins,Selenium Webdriver,我尝试使用jenkins运行selenium测试用例。我的测试用例使用maven和TestNG。测试用例在本地计算机上运行良好,而我尝试在服务器上使用jenkins运行测试用例,得到以下错误 + mvn test [INFO] Scanning for projects... [INFO] [INFO] ------------------------

我尝试使用jenkins运行selenium测试用例。我的测试用例使用maven和TestNG。测试用例在本地计算机上运行良好,而我尝试在服务器上使用jenkins运行测试用例,得到以下错误

+ mvn test
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building DataVisualisation 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ DataVisualisation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/sample-selenium-datum/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) @ DataVisualisation ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ DataVisualisation ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/sample-selenium-datum/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) @ DataVisualisation ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-surefire-plugin:2.17:test (default-test) @ DataVisualisation ---
[INFO] Surefire report directory: /home/sample-selenium-datum/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: TestNG652Configurator
Starting ChromeDriver 2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320) on port 18007
Only local connections are allowed.
May 10, 2017 7:11:11 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end
May 10, 2017 7:11:11 AM org.openqa.selenium.remote.ProtocolHandshake createSession
INFO: Detected dialect: OSS
Configuring TestNG with: TestNG652Configurator
Tests run: 5, Failures: 1, Errors: 0, Skipped: 3, Time elapsed: 2.464 sec <<< FAILURE! - in TestSuite
invokeBrowser(datum.LoginTest)  Time elapsed: 2.063 sec  <<< FAILURE!
org.openqa.selenium.NoSuchSessionException: no such session
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.4.0-71-generic x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 40 milliseconds
Build info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'
System info: host: 'devopspipe', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.4.0-71-generic', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{message=unknown error: cannot find Chrome binary
  (Driver info: chromedriver=2.27.440175 (9bc1d90b8bfa4dd181fbbf769a5eb5e575574320),platform=Linux 4.4.0-71-generic x86_64), platform=ANY}]
Session ID: 32a6fb3761613a68f59bc37a5e0d0491
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:216)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:168)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:635)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:658)
    at org.openqa.selenium.remote.RemoteWebDriver$RemoteWebDriverOptions$RemoteWindow.maximize(RemoteWebDriver.java:882)
    at datum.UtilsMethods.browserInvoke(UtilsMethods.java:77)
    at datum.LoginTest.invokeBrowser(LoginTest.java:19)

Results :

Failed tests: 
  LoginTest.invokeBrowser:19 » NoSuchSession no such session
  (Driver info: chr...

Tests run: 5, Failures: 1, Errors: 0, Skipped: 3

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.874 s
[INFO] Finished at: 2017-05-10T07:11:12+00:00
[INFO] Final Memory: 10M/28M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on project DataVisualisation: There are test failures.
[ERROR] 
[ERROR] Please refer to /home/sample-selenium-datum/target/surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Build step 'Execute shell' marked build as failure
Finished: FAILURE
+mvn测试
[信息]正在扫描项目。。。
[信息]
[信息]------------------------------------------------------------------------
[信息]构建数据可视化1.0-SNAPSHOT
[信息]------------------------------------------------------------------------
[信息]
[信息]---maven资源插件:2.6:resources(默认资源)@DataVisualization---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]跳过不存在的resourceDirectory/home/sample-selenium-datum/src/main/resources
[信息]
[信息]---maven编译器插件:3.2:compile(默认编译)@DataVisualization---
[信息]无需编译-所有类都是最新的
[信息]
[信息]---maven资源插件:2.6:testResources(默认testResources)@DataVisualization---
[信息]使用“UTF-8”编码复制筛选的资源。
[信息]跳过不存在的resourceDirectory/home/sample-selenium-datum/src/test/resources
[信息]
[信息]---maven编译器插件:3.2:testCompile(默认testCompile)@DataVisualization---
[信息]无需编译-所有类都是最新的
[信息]
[信息]---maven surefire插件:2.17:test(默认测试)@datavisualization---
[信息]Surefire报告目录:/home/sample/target/Surefire报告
-------------------------------------------------------
T T S T S
-------------------------------------------------------
运行测试套件
使用:TestNG652配置器配置TestNG
在端口18007上启动ChromeDriver 2.27.440175(9BC1D90B8BF4DD181FBBF769A5EB5E5755720)
只允许本地连接。
2017年5月10日上午7:11:11 org.openqa.selenium.remote.ProtocolHandshake createSession
信息:正在尝试双方言会话,假设远程端的Postel定律成立
2017年5月10日上午7:11:11 org.openqa.selenium.remote.ProtocolHandshake createSession
信息:检测到的方言:OSS
使用:TestNG652配置器配置TestNG

测试运行:5,失败:1,错误:0,跳过:3,经过的时间:2.464秒从您共享的日志中可以看出,selenium无法在您的计算机中找到chrome驱动程序二进制文件

所以

1-你下载了最新的chrome二进制驱动程序吗

2-您是否将chrome驱动程序的系统属性设置为二进制路径

3-您是否在代码中明确设置了路径


最好是共享您的代码

您需要解决以下一些关键问题:1<代码>使用:TestNG652配置程序配置TestNG
-向我们展示TestNG652配置程序代码。2. <代码>失败!-在TestSuite中,显示testng.xml 3
NoSuchSessionException:没有这样的会话
-向我们显示浏览器启动代码。4. <代码>驾驶员信息:chromedriver=2.27-升到chromedriver=2.29 5。在通过Jenkins执行代码之前,请尝试将TestNG代码作为TestNG测试执行,然后作为TestNG套件执行,然后作为Maven测试执行。是的,我已经完成了您要求的所有3个步骤。在本地机器上运行相同的代码时,它工作正常。但当我使用Jenkins在云上运行它时,它给出了错误。