1. Install Xvfbm, google-chrome-stable and chromedriver in Jenkins

sudo apt-get install -y xvfb google-chrome-stable

Down chromedriver from

https://sites.google.com/a/chromium.org/chromedriver/

The current version running in my jenkins server is

Google Chrome version: 54.0.2840.100

Chrome driver version: 2.25

Selenium-Java version: 2.53.0

2. Start Xvfb

To start Xvfb by command line:

Xvfb :7 &

export  DISPLAY=:7

To start Xvfb for each maven buid

<profiles>
<profile>
<id>cit-environment</id>
<activation>
<activeByDefault>false</activeByDefault>
<property>
<name>build.environment</name>
<value>jenkins</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>start-xvfb</id>
<phase>process-test-classes</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Starting xvfb" />
<exec executable="Xvfb" spawn="true">
<arg value=":1" />
</exec>
</tasks>
</configuration>
</execution>
<execution>
<id>shutdown-xvfb</id>
<phase>test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<echo message="Ending xvfb" />
<exec executable="killall">
<arg value="Xvfb" />
</exec>
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>

mvn clean install -Dbuild.environment=jenkins will trigger this plugin. Aslo remember to inject DISPLAY env variable during the build.

3. Issues Observed

Sometimes selenium just hangs on calling driver = new ChromeDriver(); So the current temporary solution is to try 10 times in a row to bring up chromedriver, and of course this is not nice.

Another issue is the page may be loaded too slow in Jenkins, causing the Selenium tests failure. Current temporary solution is to use wait.until method to wait untill an element is available.

Automated Front End Test - Xvfb, Chromedriver, Selenium, Jenkins的更多相关文章

  1. maven + selenium + jenkins 教程收集

    maven + selenium + jenkins 教程收集 Complete Guide for Selenium integration with jenkins Maven http://le ...

  2. 爬虫探索Chromedriver+Selenium初试

    今天分享Python使用Chromedriver+Selenium爬虫的的方法,Chromedriver是一个有意思的爬虫插件,这个插件的爬虫方式主要是完全模拟浏览器点击页面,一步一步去找你要的东西, ...

  3. centos7服务器无GUI情况下安装使用Xvfb、selenium、chrome和selenium-server

    最近需要用到selenium浏览器抓取,在windows下对照chrome浏览器开发的代码,在linux服务器上换成phantomjs驱动后,却不能运行了,通过截图发现phantomjs渲染效果和ch ...

  4. XVFB实现selenium在linux上无界面运行安装篇

    selenium在linux上无界面运行,其实是非常简单的.具体的方法有使用HtmlUnitDriver或者PhantomJSDriver,有时间我会写写关于这两个东东的文章,其实基本和ChromeD ...

  5. Mac 下安装python3.7 + pip 利用 chrome + chromedriver + selenium 自动打开网页并自动点击访问指定页面

    1.安装python3.7https://www.python.org/downloads/release/python-370/选择了这个版本,直接默认下一步 2.安装pipcurl https:/ ...

  6. selenium+jenkins网页自动化测试的构建

    jenkins+selenium可以做到对web自动化的持续集成. Jenkins的基本操作: 一.新建视图及job 新建视图: 新建job: 可以选择构建一个自由风格的软件项目或者复制已有的item ...

  7. selenium+jenkins+maven+testNG搭建持续集成环境

    为了简明起见,分几大部分,很基础的细节就不详述了 一·安装jenkins 二·创建一个maven项目的job 2.1   填上SVN的Repository URL 2.2  由于是在本地执行maven ...

  8. 连载三:RobotFramework+Selenium+Jenkins分布式构建

    目标:Jenkins安装在服务器上,而使用Jenkins调用本机的脚本并在本机执行. 步骤: (1)需要有RobotFrameWork+Selenium的运行环境: python2.7,Robotfr ...

  9. ChromeDriver+Selenium安装

    介绍 Selenium是一个自动化测试工具,利用它我们可以驱动浏览器执行特定的动作,如点击.下拉等操作. ChromeDriver是一个Chrome浏览器驱动,用于驱动Chrome浏览器完成相应的操作 ...

随机推荐

  1. Excel图表-太极图

    p{ font-size: 15px; } .alexrootdiv>div{ background: #eeeeee; border: 1px solid #aaa; width: 99%; ...

  2. 老李推荐:第5章5节《MonkeyRunner源码剖析》Monkey原理分析-启动运行: 获取系统服务引用

    老李推荐:第5章5节<MonkeyRunner源码剖析>Monkey原理分析-启动运行: 获取系统服务引用   上一节我们描述了monkey的命令处理入口函数run是如何调用optionP ...

  3. POI 操作Excel疑难点笔记

    在POI中,我们可以通过Workbook, Sheet, Row, Cell 对象分别对应Excel文件.工作表.行.单元格. 在POI的使用中,我遇到了几个非常诡异.捉摸不透的问题,现在记录下来. ...

  4. “this kernel requires an x86-64 CPU, but only detects an i686 CPU, unable to boot” 问题解决

    1. 问题描述:  在Virtual Box上安装 Ubuntu 系统时出现错误(如题),VIrtual Box 上也没有64位操作系统的选项 2.原因分析: (1) 可能 BIOS 的 Virtua ...

  5. openssl命令行-证书认证

      命令1: openssl genrsa -out root.key 1024 产生一个root.key的私钥 命令2: openssl req -key root.key -new -out ro ...

  6. [Linux] PHP程序员玩转Linux系列-telnet轻松使用邮箱

    1.PHP程序员玩转Linux系列-怎么安装使用CentOS 2.PHP程序员玩转Linux系列-lnmp环境的搭建 3.PHP程序员玩转Linux系列-搭建FTP代码开发环境 4.PHP程序员玩转L ...

  7. python自动化测试应用-第6篇(WEB测试)--Selenium元素篇

    篇6                            python自动化测试应用-Selenium基础篇 --lamecho 1.1概要 大家好!我是lamecho(辣么丑),上一篇我们搭建好p ...

  8. bzoj2876 [Noi2012]骑行川藏

    Description 蛋蛋非常热衷于挑战自我,今年暑假他准备沿川藏线骑着自行车从成都前往拉萨.川藏线的沿途有着非常美丽的风景,但在这一路上也有着很多的艰难险阻,路况变化多端,而蛋蛋的体力十分有限,因 ...

  9. 【Atom】在一个中/大型项目中,那些好用而强大的atom功能

      作为一个学生党,一开始使用atom时候并没有意识到atom一些小功能的巨大作用,直到自己实习参与了项目,才知道这些功能在一个项目中是能极大提高工作效率的开发利器   下面是一位不愿意透露其姓名的彭 ...

  10. 蓝桥杯-兰顿蚂蚁-java

    /* (程序头部注释开始) * 程序的版权和版本声明部分 * Copyright (c) 2016, 广州科技贸易职业学院信息工程系学生 * All rights reserved. * 文件名称: ...