jenkins linux编译c,【Linux】【Jenkins】代码编译和执行过程中的问题汇总

1.问题1:java.io.FileNotFoundException: /root/.jenkins/workspace/Videoyi_AutoTest_Maven/config-log4j\log4j.xml (No such file or directory)

该问题是由于代码是在windows下编写和编译的,使用的都是\\来实现目录结构的,结果到linux下的时候,linux不能识别\\,所以需要将代码的\\修改为/。

2、问题:Linux下执行时,调用的是windows下的chroomedriver导致不能启动浏览器。

该问题待调查

java.lang.IllegalStateException: The driver is not executable: /root/.jenkins/workspace/Videoyi_AutoTest_Maven/browserDriver/chromedriver.exe

at com.google.common.base.Preconditions.checkState(Preconditions.java:199)

at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:125)

at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:116)

at org.openqa.selenium.chrome.ChromeDriverService.access$000(ChromeDriverService.java:32)

at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable(ChromeDriverService.java:137)

报以上错误的时候,下载了一个Linux下的Chrome浏览器,然后就OK了不报错了。

https://blog.csdn.net/chenlix/article/details/72526205

3、然后安装完chromedriver后,还是报错。

接下来报的是业务方面的错误了

[2018-05-25 10:35:12:498] [ai.qa.autotest.ui.framework.webdriverfactory.ChromeBrowserDriver] [INFO] [46] [----- ?????Linux??.-----]

[2018-05-25 10:35:12:568] [ai.qa.autotest.ui.framework.webdriverfactory.ChromeBrowserDriver] [ERROR] [77] [java.lang.IllegalStateException: The driver is not executable: /root/.jenkins/workspace/Videoyi_AutoTest_Maven/browserDriver/chromedriver]

该错误的解决方案是,找到chromedriver的可执行文件然后给他加上执行的权限。

52cbfe3238bbafa7c861ff0e55496d45.png

4、好不容易能进入到函数的运行体了,但是中文输出出来都是乱码或者问号,所以继续调查这个问题。

53698a07a35001229eb142c0a1c0fa72.png

/root/.jenkins/workspace/Videoyi_AutoTest_Maven/browserDriver/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

������ 25, 2018 11:03:15 ������ org.openqa.selenium.os.UnixProcess checkForError

������: org.apache.commons.exec.ExecuteException: Process exited with an error: 127 (Exit value: 127)

[2018-05-25 11:03:15:590] [ai.qa.autotest.ui.framework.webdriverfactory.ChromeBrowserDriver] [ERROR] [77] [org.openqa.selenium.remote.UnreachableBrowserException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.

Build info: version: '2.52.0', revision: '4c2593cfc3689a7fcd7be52549167e5ccc93ad28', time: '2016-02-11 11:22:43'

解决方案如下:

39c388e33d56f13bb40dcfee1bf5a014.png

https://blog.csdn.net/dumeifang/article/details/2963223

乱码问题:

http://lee2013.iteye.com/blog/2108612

还是未解决乱码的问题。

3639208da195051142abdd267aa6ca91.png

居然天神奇了,我按照这个又把这些都改回到初始的状态,结果是正常的中文码了,可是我删了啊。。不知道下次重启会不会是乱码呢。

http://lee2013.iteye.com/blog/2108612

5、编译的时候报错,导致chromeBrowserDriver无法启动。

/root/.jenkins/workspace/Videoyi_AutoTest_Maven/browserDriver/chromedriver: error while loading shared libraries: libgconf-2.so.4: cannot open shared object file: No such file or directory

参考的解决方案:

https://www.cnblogs.com/Anker/p/3209876.html

https://www.cnblogs.com/amboyna/archive/2008/02/06/1065322.html

那就表示系統不知道xxx.so 放在哪個目錄下。

這個時候就要在/etc/ld.so.conf中加入xxx.so所在的目錄。

一般而言,有很多so檔會在/usr/local/lib這個目錄下,所以在/etc/ld.so.conf中加入/usr/local/lib這一行,可以解決此問題。

將/etc/ld.so.conf存檔後,還要執行「/sbin/ldconfig –v」來更新一下才會生效。

https://stackoverflow.com/questions/37624225/shared-libraries-libgconf-2-so-4-is-missing

居然说是这个帮忙了,本来想自己下载个

libgconf-2.so.4然后再安装到linux下,结果发现这个网址上有攻略。

down vote

Please ask yumfor the file, libgconf-2.so.4 : $ yum provides */libgconf-2.so.4Install GConf2 : # yum install GConf2

Packages http://mirror.centos.org/centos/6.8/os/ ... and updateshttp://mirror.centos.org/centos/6.8/updates/

The chromedriver depends on the same packages/ files as GConf2, and then some. Please see for yourself : $ ldd chromedriver , where 'chromedriver' is the unzipped executable.

20e34c6de19c08661b6c2e689d117892.png

6、好不容易把chromeDriver的libconfig问题解决了,但是又报了新的错误。

cb20801eee043ce2e946ef93faf43a69.png

原因可能是:chrome和chromedriver的版本不匹配。

原因分析:是由于chrome版本过低导致的

解决办法:重新下一个比 29.0.1545.0版本高的chrome就可以了

Chrome的版本:

989c1f2db1cc7caeee2c4679145e9f7f.png

ChromeDriver的版本:

当前使用的是2.29版本,所以会报错。

然后下载2.36版本,并上传后,并修改他的可执行权限,静待效果。

https://npm.taobao.org/mirrors/chromedriver

Chrome和ChromeDriver的对照表:

https://blog.csdn.net/huilan_same/article/details/51896672

Linux下配置chromeDriver:

ln -s /usr/local/share/chromedriver /usr/local/bin/chromedriver

ln -s /usr/local/share/chromedriver /usr/bin/chromedriver

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值