inselberg
inselberg

Reputation: 959

Running selenium (chromedriver) in a terminal window?

How can i run a python script using selenium (chromedriver) in an terminal window (without X forwarding).

The results/interactions with the website don't need to be shown. Par example filling a form scheduled by a cronjob.

Upvotes: 3

Views: 3438

Answers (1)

r-m-n
r-m-n

Reputation: 15090

you can use PyVirtualDisplay with Xvfb

from pyvirtualdisplay import Display
from selenium import webdriver

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

# now Chrome will run in a virtual display. 
browser = webdriver.Chrome()
browser.get('http://www.google.com')

Upvotes: 4

Related Questions