Here is some Python code showing WebDriver with a virtual display provided by Xvfb:

#!/usr/bin/env python

from pyvirtualdisplay import Display
from selenium import webdriver display = Display(visible=0, size=(800, 600))
display.start() # now Firefox will run in a virtual display.
# you will not see the browser.
browser = webdriver.Firefox()
browser.get('http://www.google.com')
print browser.title
browser.quit() display.stop()

install PyVirtualDisplay on Ubuntu/Debian:

$ sudo apt-get install xvfb python-pip
$ sudo pip install pyvirtualdisplay

Python - Headless Selenium WebDriver Tests using PyVirtualDisplay的更多相关文章

  1. Python:Selenium+Webdriver安装

    本人小白一枚,今天在使用selenium+webdriver的时候遇到了一个小问题: WebDriverException: 'chromedriver' executable needs to be ...

  2. Python语言-selenium webdriver操作记录汇总

    1.控制浏览器大小 set_window_size() 设置浏览器大小 该方法有两个参数,第一个参数是宽,第二个是高 maximize_window() 设置浏览器全屏显示,无参数 chrome谷歌浏 ...

  3. Selenium - WebDriver: Locating Elements

    Selenium provides the following methods to locate elements in a page: find_element_by_id find_elemen ...

  4. Selenium - WebDriver Advanced Usage

    Explicit Waits # Python from selenium import webdriver from selenium.webdriver.common.by import By f ...

  5. selenium webdriver python 开始

    学习资料: Selenium with Python: http://selenium-python.readthedocs.org/en/latest/index.html 乙醇的python se ...

  6. selenium webdriver (python)的基本用法一

    阅在线 AIP 文档:http://selenium.googlecode.com/git/docs/api/py/index.html目录一.selenium+python 环境搭建........ ...

  7. Python selenium.webdriver.chrome.options.Options() Examples

    The following are 27 code examples for showing how to use selenium.webdriver.chrome.options.Options( ...

  8. chrome headless+selenium+python+(ubuntu 16.04/centos7) 下的实现

    Ubuntu 16.04 下: 0x01 安装chrome 1 下载源加入系统源列表 sudo wget http://www.linuxidc.com/files/repo/google-chrom ...

  9. python利用selenium(webdriver chrome)模拟登陆获取cookie

    (我是在windows下进行实验的) 准备工作: 1.安装python环境. 2.python安装selenium插件(执行以下命令就行).   pip install selenium 3.Wind ...

随机推荐

  1. C# 通过接口 post 请求

    /// <summary> /// 提交数据请求 方法一 /// </summary> /// <param name="POSTURL">请求 ...

  2. zf-关于更改账号密码的问题

    一般项目的数据库里都会有一个 SYS_USER表 里面有账号密码 一般 202……70 的都是123加密后的字符串 如果碰到项目运行之后不知道登陆密码的时候 可以在数据库中 把USER_PASS 改成 ...

  3. 如何添加在eclipse 中添加 window Builder

    将features文件夹和plugins文件夹添加到eclipse的dropins文件夹下 然后再用专业的软件来破解 提供软件: WindowBuilderKeygen.exe

  4. StrictMode使用详解

    http://hb.qq.com/a/20110914/000054.htm http://www.android100.org/html/201204/25/1097.html http://www ...

  5. CentOS 7 安装 GlusterFS

    CentOS 7 GlusterFS 环境说明: 3台机器安装 GlusterFS 组成一个集群. 使用 docker volume plugin GlusterFS 服务器: 10.6.0.140 ...

  6. UITextField和UIViewConteoller

    UITextField控件 UITextFiled常用属性和方法   UITextField是常用的文本输入控件,比如我们用的QQ的登录界面,词典输入要查询的单词都使用了文本框控件,如下图所示.之前介 ...

  7. FMDB 查询是否存在某个表,或某个数据

    //监测数据库中我要需要的表是否已经存在 NSString *existsSql = [NSString stringWithFormat:@"select count(name) as c ...

  8. PHP 对MySQLI预处理的包装

    mysql 类 <?php class Mysql { private static $instance; private $link; private $query; private $stm ...

  9. CodeForces 618C CodeForces 618C

    第一反应是在凸包上随便找一条边,然后找剩下n-2个点里面距离这条边最短的一个点,这三点就构成了符合要求的三角形..然而..精度被卡死. 换种思路,随便找两个点P1,P2,找剩下n-2个点中哪一个点与P ...

  10. Eclipse JDK的安装

    1.jdk安装无法配置,eclipse绿色版安装无法打开,系统的版本问题(32位和64位): 2.Eclipse下载PDT时,可以如下安装: 三个地方设置好即可,其实第三个选第一个的话会出现无法提供函 ...