selenium 服务器使用selenium
安装 xvfbsudo apt install xvfb
安装 pyvirtualdisplay
sudo pip install pyvirtualdisplay
安装 chrome, chromedriverhttps://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()
页:
[1]