Automated Front End Test - Xvfb, Chromedriver, Selenium, Jenkins
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的更多相关文章
- maven + selenium + jenkins 教程收集
maven + selenium + jenkins 教程收集 Complete Guide for Selenium integration with jenkins Maven http://le ...
- 爬虫探索Chromedriver+Selenium初试
今天分享Python使用Chromedriver+Selenium爬虫的的方法,Chromedriver是一个有意思的爬虫插件,这个插件的爬虫方式主要是完全模拟浏览器点击页面,一步一步去找你要的东西, ...
- centos7服务器无GUI情况下安装使用Xvfb、selenium、chrome和selenium-server
最近需要用到selenium浏览器抓取,在windows下对照chrome浏览器开发的代码,在linux服务器上换成phantomjs驱动后,却不能运行了,通过截图发现phantomjs渲染效果和ch ...
- XVFB实现selenium在linux上无界面运行安装篇
selenium在linux上无界面运行,其实是非常简单的.具体的方法有使用HtmlUnitDriver或者PhantomJSDriver,有时间我会写写关于这两个东东的文章,其实基本和ChromeD ...
- Mac 下安装python3.7 + pip 利用 chrome + chromedriver + selenium 自动打开网页并自动点击访问指定页面
1.安装python3.7https://www.python.org/downloads/release/python-370/选择了这个版本,直接默认下一步 2.安装pipcurl https:/ ...
- selenium+jenkins网页自动化测试的构建
jenkins+selenium可以做到对web自动化的持续集成. Jenkins的基本操作: 一.新建视图及job 新建视图: 新建job: 可以选择构建一个自由风格的软件项目或者复制已有的item ...
- selenium+jenkins+maven+testNG搭建持续集成环境
为了简明起见,分几大部分,很基础的细节就不详述了 一·安装jenkins 二·创建一个maven项目的job 2.1 填上SVN的Repository URL 2.2 由于是在本地执行maven ...
- 连载三:RobotFramework+Selenium+Jenkins分布式构建
目标:Jenkins安装在服务器上,而使用Jenkins调用本机的脚本并在本机执行. 步骤: (1)需要有RobotFrameWork+Selenium的运行环境: python2.7,Robotfr ...
- ChromeDriver+Selenium安装
介绍 Selenium是一个自动化测试工具,利用它我们可以驱动浏览器执行特定的动作,如点击.下拉等操作. ChromeDriver是一个Chrome浏览器驱动,用于驱动Chrome浏览器完成相应的操作 ...
随机推荐
- async/await的多线程问题
今天尝试把.net4.5新增的异步编程模型async/await加入自己的框架,因为从第一印象看,使用async/await的写法实在太方便了,以同步代码的方式写异步流程,写起来更顺畅,不容易打断思路 ...
- 达到工业使用质量级别的类似于QQ截屏的软件
到网上查找截屏发现基本都是一些小孩子的初级玩意,功能强大一点的又没有源代码所以自己花了三四天时间写了一个能达到工业使用质量级别的截图控件. 优点:1.代码量小只有1500行代码 2.结构清晰简单极易于 ...
- 1102: 零起点学算法09——继续练习简单的输入和计算(a-b)
1102: 零起点学算法09--继续练习简单的输入和计算(a-b) Time Limit: 1 Sec Memory Limit: 520 MB 64bit IO Format: %lldSub ...
- hdoj_2546饭卡(强忍悲痛,好好写题解)
Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额.如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为负) ...
- Java NIO之Buffers
一.前言 在笔者打算学习Netty框架时,发现很有必要先学习NIO,因此便有了本博文,首先介绍的是NIO中的缓冲. 二.缓冲 2.1 层次结构图 除了布尔类型外,其他基本类型都有相对应的缓冲区类,其继 ...
- 聊聊 Tomcat 的单机多实例
Tomcat 从何而来? 先说 Tomcat 这一单词解释,如果你不是一个开发者,当然它在美国口语中并非是褒义词:如果你是开发者,那你一定听过 Web 应用服务器.Sun 公司和 Tomcat .如你 ...
- JDBC的使用流程
//导入包: import java.sql.*; //注册JDBC驱动程序: Class.forName("com.mysql.jdbc.Driver"); //打开一个连接: ...
- HashMap负载因子
下面是HashMap的一个构造函数,两个参数initialCapacity,loadFactor 这关系HashMap的迭代性能. /** * Constructs an empty <tt&g ...
- 内嵌的Component调用外部的方法
如果一个内嵌的Component控件需要调用外部定义的方法,用outerDocument.方法名来调用,前提是该方法是public的.如:<mx:DataGridColumn headerTex ...
- python——进程、线程、协程
Python线程 Threading用于提供线程相关的操作,线程是应用程序中工作的最小单元. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #!/usr/bin/env pytho ...