Jenkins maven调用webdriver报错
最近在研究自动化测试selenium+eclipse+testng+maven+Jenkins
创建了一个maven项目,用testng框架写了一个类,调用webdriver,chromedriver访问百度,功能很简单
右键testng.xml选择 run as testng可以成功执行
在maven里面配置pom.xml来调用testng.xml,run asmaven test也可以成功调用chromedriver访问百度
我把功能集成在Jenkins里面,配置项一共有两个,
一个是从svn下载代码,
还有一个就是maven
Root POMpom.xml
Goals and options
执行构建,报错如下,代码应该下载成功了,但是调用chromedriver的时候报这个错,希望有大神来解决
Started by user adminBuilding in workspace C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4Updating svn://172.17.184.50/DM/QMC/05.测试/cyh/SeleniumMvn2 at revision '2017-02-13T16:41:31.696 +0800'At revision 4208No changes for svn://172.17.184.50/DM/QMC/05.%E6%B5%8B%E8%AF%95/cyh/SeleniumMvn2 since the previous buildParsing POMsEstablished TCP socket on 13753 $ "C:\Program Files\Java\jdk1.8.0_40/bin/java" -cp C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-agent-1.8.1.jar;F:\autotest\maven\apache-maven-3.3.3\boot\plexus-classworlds-2.5.2.jar;F:\autotest\maven\apache-maven-3.3.3/conf/logging jenkins.maven3.agent.Maven33Main F:\autotest\maven\apache-maven-3.3.3 "C:\Program Files\Apache Software Foundation\Tomcat 9.0\webapps\jenkins\WEB-INF\lib\remoting-3.4.1.jar" C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven33-interceptor-1.8.1.jar C:\windows\system32\config\systemprofile\.jenkins\plugins\maven-plugin\WEB-INF\lib\maven3-interceptor-commons-1.8.1.jar 13753<======>channel startedExecuting Maven:-B -f C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\pom.xml test -Dmaven.repo.local=C:/Users/Administrator/.m2/repository Scanning for projects... ------------------------------------------------------------------------ Building SeleniumMvn2 0.0.1-SNAPSHOT ------------------------------------------------------------------------ --- maven-resources-plugin:2.6:resources (default-resources) @ SeleniumMvn2 --- Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\src\main\resources --- maven-compiler-plugin:2.3.2:compile (default-compile) @ SeleniumMvn2 --- Nothing to compile - all classes are up to date --- maven-resources-plugin:2.6:testResources (default-testResources) @ SeleniumMvn2 --- Using 'UTF-8' encoding to copy filtered resources. skip non existing resourceDirectory C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\src\test\resources --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ SeleniumMvn2 --- Nothing to compile - all classes are up to date --- maven-surefire-plugin:2.17:test (default-test) @ SeleniumMvn2 --- Surefire report directory: C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\target\surefire-reports------------------------------------------------------- T E S T S-------------------------------------------------------Running TestSuiteStarting ChromeDriver 2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc) on port 45482Only local connections are allowed.二月 13, 2017 4:41:36 下午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Attempting bi-dialect session, assuming Postel's Law holds true on the remote end二月 13, 2017 4:41:36 下午 org.openqa.selenium.remote.ProtocolHandshake createSession信息: Detected dialect: OSSTests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 1.247 sec <<< FAILURE! - in TestSuitef(SeleniumMvn2.testmvn1)Time elapsed: 0.964 sec<<< FAILURE!org.openqa.selenium.NoSuchSessionException: no such session(Driver info: chromedriver=2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc),platform=Windows NT 6.1 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)Command duration or timeout: 43 millisecondsBuild info: version: '3.0.1', revision: '1969d75', time: '2016-10-18 09:49:13 -0700'System info: host: 'PC-201604071707', ip: '192.168.202.10', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_40'Driver info: org.openqa.selenium.chrome.ChromeDriverCapabilities [{message=unknown error: cannot find Chrome binary(Driver info: chromedriver=2.20.366854 (5ec7646c06c3266f27ae291db023e006190cc1cc),platform=Windows NT 6.1 SP1 x86_64), platform=ANY}]Session ID: 4f2e96fa4547f1461c05f08b3038c98e 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:422) 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.get(RemoteWebDriver.java:322) at SeleniumMvn2.testmvn1.f(testmvn1.java:24)Results :Failed tests: testmvn1.f:24 ? NoSuchSession no such session(Driver info: chromedriver=2.2...Tests run: 1, Failures: 1, Errors: 0, Skipped: 0 There are test failures.Please refer to C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\target\surefire-reports for the individual test results. Recording test results ------------------------------------------------------------------------ BUILD SUCCESS ------------------------------------------------------------------------ Total time: 4.759 s Finished at: 2017-02-13T16:41:38+08:00 Final Memory: 16M/316M ------------------------------------------------------------------------ Archiving C:\windows\system32\config\systemprofile\.jenkins\workspace\SeleniumMaven4\pom.xml to org.test/SeleniumMvn2/0.0.1-SNAPSHOT/SeleniumMvn2-0.0.1-SNAPSHOT.pomchannel stoppedFinished: UNSTABLE
加油吧
页:
[1]