Monday, 7 January 2019

Headless Selenium + Xvfb + Chrome on OSX 10.11

Okay, so first I learned that xvfb wasn't included with my osx version, so I installed it from: http://www.xquartz.org/

and that seemed to have worked:

which xvfb
/opt/X11/bin/xvfb

But when I try using it with either pyvirtualdisplay and xvfbwrapper, following advice I found on this question How do I run Selenium in Xvfb? My script runs without errors, but just opens in a chrome browser window.

from selenium import webdriver
from pyvirtualdisplay import Display

display = Display(visible=0, size=(800, 600))
display.start()

browser = webdriver.Chrome()
browser.get('google.com')

Am I doing something wrong here?



from Headless Selenium + Xvfb + Chrome on OSX 10.11

No comments:

Post a Comment