51Testing软件测试论坛
标题: selenium 服务器使用selenium [打印本页]
作者: 测试积点老人 时间: 2019-1-4 15:41
标题: selenium 服务器使用selenium
安装 xvfb
安装 pyvirtualdisplay
- sudo pip install pyvirtualdisplay
复制代码
安装 chrome, chromedriver
https://sites.google.com/a/chromium.org/chromedriver/downloads
用法
- import time
- from pyvirtualdisplay import Display
- from selenium import webdriver
-
- url = "http://www.163.com"
- with Display(backend="xvfb", size=(1024, 768)):
- driver = webdriver.Chrome()
- driver.maximize_window()
- driver.get(url)
- driver.quit()
复制代码
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) |
Powered by Discuz! X3.2 |