Skip to content

Webdriver student project

Manish Goregaokar edited this page Feb 9, 2015 · 5 revisions

Implement WebDriver support

Background information: WebDriver is a tool that's used for automatically testing web applications. It has also been adapted for automating web browsers while running tests. This project aims to create a server that will receive connections from WebDriver clients and execute commands to improve our test automation abilities.

Initial step: Build Servo, then email the mozilla.dev.servo mailing list introducing your group. Make a new crate (aka library) that will be responsible for running a server and interacting with the protocol (see components/devtools_traits for an example of a minimal crate). Add a run_server function that takes a port number, and call it using the result of parsing a --webdriver command line argument from the code in components/servo/lib.rs. Use the code that starts a devtools server for reference (see components/devtools/lib.rs and components/servo/lib.rs).

Subsequent steps:

  • Import the webdriver-rust library by modifying the appropriate Cargo.toml and start a server from the run_server function added previously. Use a stub implementation of the WebDriverHandler that only includes as much code as is necessary to make it compile.
  • Process the NewSession/DeleteSession command by creating the necessary state and storing it in a hashtable in the new webdriver crate.
  • Process the Get command by sending a message to the script task to initiate a load of the given URL.
  • Process the ExecuteAsyncScript command by instructing the script task to execute the given JavaScript, using handle_evaluate_js in components/script/devtools.rs as a model.
  • Process the ExecuteScript command using ExecuteAsyncScript as a basis.
  • Process the TakeScreenshot command by instructing the compositor to output a screenshot (see composite in components/compositing/compositor.rs.
Clone this wiki locally