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菜单上看,代理分为好几种 我这 ...
随机推荐
- C# 中的枚举类型 enum (属于值类型)
原文 C# 中的枚举类型 enum (属于值类型) C# 支持两种特殊的值类型:枚举和结构. 声明枚举:声明时要声明所有可能的值. using System; using System.Collect ...
- dephi WaitForMultipleObjects 用法
在Delphi中WaitForMultipleObjects的使用 procedure ThreadTest;stdcall; var Handles:TWOHandleArray; //Hand ...
- 【原】Redis-LRU缓存
Redis高级篇 Redis-LRU缓存 将Redis作为缓存使用时,有时添加新数据时,旧数据是很难被清空的. LRU(Least Recently Used) 近期最少使用算法是常用算法之一. 最大 ...
- bzoj 3295 [Cqoi2011]动态逆序对(cdq分治,BIT)
[题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3295 [题意] n个元素依次删除m个元素,求删除元素之前序列有多少个逆序对. [思路] ...
- Node与Express开发 坑1
添加 app.set('views', __dirname + '/views') 修改 app.use(express.static(__dirname + '/public')); express ...
- Hdu 5289-Assignment 贪心,ST表
题目: http://acm.hdu.edu.cn/showproblem.php?pid=5289 Assignment Time Limit: 4000/2000 MS (Java/Others) ...
- hdoj 1106 排序
排序 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- linux tomcat自启动设置
国内私募机构九鼎控股打造APP,来就送 20元现金领取地址:http://jdb.jiudingcapital.com/phone.html内部邀请码:C8E245J (不写邀请码,没有现金送)国内私 ...
- 【推荐】对 Linux 用户非常有用的 60 个命令(由浅入深)
对 Linux 新手非常有用的 20 个命令 http://www.oschina.net/translate/useful-linux-commands-for-newbies 对 Linux 中级 ...
- cocos2d-x Menu、MenuItem
转自:http://codingnow.cn/cocos2d-x/832.html 学习cocos2d-x中的菜单主要需要了解:菜单(CCMenu)和菜单项(CCMenuItem)以及CCMenuIt ...