zoukankan      html  css  js  c++  java
  • 【Linux】【Jenkins】代码编译和执行过程中的问题汇总



    1.问题1:java.io.FileNotFoundException: /root/.jenkins/workspace/Videoyi_AutoTest_Maven/config-log4jlog4j.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的可执行文件然后给他加上执行的权限。

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

    /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'
    解决方案如下:

    https://blog.csdn.net/dumeifang/article/details/2963223
    乱码问题:
    http://lee2013.iteye.com/blog/2108612
    还是未解决乱码的问题。

    居然天神奇了,我按照这个又把这些都改回到初始的状态,结果是正常的中文码了,可是我删了啊。。不知道下次重启会不会是乱码呢。
    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 yum for the file, libgconf-2.so.4 : $ yum provides */libgconf-2.so.4
    
    Install GConf2 : # yum install GConf2
    
    Packages http://mirror.centos.org/centos/6.8/os/ ... and updates http://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.
     

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

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

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

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

    Chrome的版本:

    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



  • 相关阅读:
    function与感叹号
    js中的|| 与 &&
    [转] html屏蔽右键、禁止复制
    ExtJS 5.1 WINDOW BLUR
    ExtJS 网页版执行工具
    Excel 随即获得一组数据集中的数据
    [转] Spring Data JPA Tutorial: Pagination
    Set up eclipse for Ext js and spket IDE plugin
    ExtJS Alias, xtype and widget
    ExtJS stores
  • 原文地址:https://www.cnblogs.com/conquerorren/p/9083938.html
Copyright © 2011-2022 走看看