Skip to content

Control Servo using WebDriver

Bastien Orivel edited this page Sep 9, 2018 · 2 revisions

First, run an instance of Servo with the webdriver server enabled on a particular port (and optionally a particular resolution):

$ ./mach run --webdriver=7002 --resolution=400x300

From another terminal window, use curl or wget to interact with the webdriver web server inside of Servo (requires that the jq utility is installed):

# Create a session for subsequent commands
$ SESSIONID=$(curl -X POST -d "{}" http://localhost:7002/session | jq -r ".value.sessionId")

# Load the desired URL
$ curl -v -X POST -d '{"url": "http://example.org"}' http://localhost:7002/session/${SESSIONID}/url

# Save a screenshot of the current content to a file
$ curl -v http://localhost:7002/session/${SESSIONID}/screenshot | jq -r ".value" | base64 -d > test1.png
Clone this wiki locally