WebDriver: Getting it to play nicely with Xvfb
http://www.markhneedham.com/blog/2011/12/15/webdriver-getting-it-to-play-nicely-with-xvfb/
Thoughts on Software Development
Another thing we’ve been doing with WebDriver is having it run with the FirefoxDriver while redirecting the display output into the Xvfb framebuffer so that we can run it on our continuous integration agents which don’t have a display attached.
The first thing we needed to do was set the environment property ‘webdriver.firefox.bin’ to our own script which would point the display to Xvfb before starting Firefox:
import java.lang.System._ |
Our first version of the script looked like this:
/our/awesome/starting-firefox.sh
#!/bin/bash |
The mistake we made here was that we started Xvfb in the background which meant that sometimes it hadn’t actually started by the time Firefox tried to connect to the display and we ended up with this error message:
No Protocol specified |
We really wanted to keep Xvfb running regardless of whether the Firefox instances being used by WebDriver were alive or not so we moved the starting of Xvfb out into a separate script which we run as one of the earlier steps in the build.
We also struggled to get the FirefoxDriver to kill itself after each test as calling ‘close’ or ‘quit’ on the driver didn’t seem to kill off the process.
We eventually resorted to putting a ‘pkill firefox’ statement at the start of our firefox starting script:
/our/awesome/starting-firefox.sh
#!/bin/bash |
It’s a bit hacky but it does the job more deterministically than anything else we’ve tried previously.
WebDriver: Getting it to play nicely with Xvfb的更多相关文章
- Python - Headless Selenium WebDriver Tests using PyVirtualDisplay
Here is some Python code showing WebDriver with a virtual display provided by Xvfb: #!/usr/bin/env p ...
- centos7服务器无GUI情况下安装使用Xvfb、selenium、chrome和selenium-server
最近需要用到selenium浏览器抓取,在windows下对照chrome浏览器开发的代码,在linux服务器上换成phantomjs驱动后,却不能运行了,通过截图发现phantomjs渲染效果和ch ...
- 【自动化测试&爬虫系列】Selenium Webdriver
文章来源:公众号-智能化IT系统. 一. Selenium Webdriver技术介绍 1. 简介 selenium Webdriver是一套针对不同浏览器而开发的web应用自动化测试代码库.使用这套 ...
- Python selenium.webdriver.chrome.options.Options() Examples
The following are 27 code examples for showing how to use selenium.webdriver.chrome.options.Options( ...
- AutoIt实现Webdriver自动化测试文件上传
在运用WebDriver进行自动化测试时,由于WebDriver自身的限制,对于上传文件时Windows弹出的文件选择窗口无法控制,通过在网上查找资料锁定使用AutoIt来控制文件上传窗口. Auto ...
- webdriver学习笔记
该篇文章记录本人在学习及使用webdriver做自动化测试时遇到的各种问题及解决方式,问题比较杂乱.问题的解决方式来源五花八门,如有疑问请随时指正一遍改正. 1.WebDriver入门 //webdr ...
- Selenium WebDriver Code
Selenium WebDriver 用于模拟浏览器的功能,可以做网站测试用,也可以用来做crawler.我是用eclipse开发的,导入selenium-server-standalone-***. ...
- 使用httpclient 调用selenium webdriver
结合上次研究的selenium webdriver potocol ,自己写http request调用remote driver代替selenium API selenium web driver ...
- Selenium FF WebDriver 加载firebug 和设置代理
首先这次使用的webDriver for Firefox的 由于项目的原因,需要在测试的时候加载Firebug和使用vpn,加载代理 Firefox 加载代理,可以从FF菜单上看,代理分为好几种 我这 ...
随机推荐
- 第一章 Lambda表达式
1.1 Why Lambdas? 当你操作多线程的时候,你会像下面这样将要处理的代码放到run()函数中: class Worker implements Runnable { public void ...
- 房租管理小软件(六):通用功能包括时间,效验,MD5加密,XML 操作
1.时间相关 public static DateTime getNow() { MyFZDataContext dataContext = MyFZDataContext.getDataContex ...
- -Xms 和 -Xmx 不能设置的太大
之前我一直有一个疑问,就是-Xms 和 -Xmx不是设置的越大越好吗?现在才明白怎么回事. 通过在命令行中执行 java 或者启动某种基于 Java 的中间件来运行 Java 应用程序时,Java 运 ...
- HW6.18
public class Solution { public static void main(String[] args) { double[] array = {6.0, 4.4, 1.9, 2. ...
- BNUOJ-26586 Simon the Spider 最小生成树+枚举
题目链接:http://www.bnuoj.com/bnuoj/problem_show.php?pid=26586 题意:给一个图,每条边有一个权值.要你求选择一棵树,权值和为sum,然后在树上选择 ...
- semget() semop()
semget() 可以使用系统调用semget()创建一个新的信号量集,或者存取一个已经存在的信号量集: 系统调用:semget();原型:intsemget(key_t key,int nsems, ...
- [OC Foundation框架 - 1] 常用结构体
底层封装是使用了typedef定义的结构体 typedef struct _NSString{ xxx xxx } NSString; 1. NSRange 结构体 #注意结构体不是对象 3种定义 ...
- Linux基本操作 9----- 认识与学习bash
一 认识bash这个shell 1 管理整个计算机硬件的其实就是操作系统的内核,这个内核是需要被保护的,所以我们一般用户就只能通过shell来跟内核通信,以让内核达到我们所想打到的工作. 2 只要能够 ...
- ecshop数据库表结构
ecs_account_log //用户账目日志表 ecs_activity //活动表(代码,名称,开始,结束,描述) ecs_ad //广告表(位置,类型,名称,链接,图片,开始,结束,广告主相关 ...
- 数组和集合List的相互转化
一.数组转为List 调用Arrays类的静态方法asList static void convertArray2List() { String[] strs = new String[]{" ...