selenium 不打開瀏覽器窗口模擬瀏覽器

1. 安裝 xvfb

xvfb:?Xvfb is an X server that can run on machines with no display hardware and no physical input devices. It emulates a dumb framebuffer using virtual memory.

2. 安裝 pyvirtualdisplay

pyvirtualdisplay:?pyvirtualdisplay is a python wrapper for Xvfb, Xephyr and Xvnc

3. 安裝 chrome 瀏覽器


4. 安裝 chromedriver

chromedriver: ChromeDriver is a separate executable that WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors. If you are unfamiliar with WebDriver, you should check out their own?Getting Started?page.


5. 示例





:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: