Is there a way to run Selenium tests on a remote host?

Cos64 picture Cos64 · Nov 21, 2016 · Viewed 7.9k times · Source

I would like to run the following setup:

  • on host_1, execute some Selenium tests
  • on host_2, run Firefox

(On host_1 there would be a Jenkins instance running the tests and host_2 would be a Docker container running on host_1, and Firefox would run headless, using xvfb - but this shouldn't be relevant for the question)

To run on the same host, I would just do:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver");

WebDriver driver = new FirefoxDriver();
driver.get("https://google.com/");
driver.quit();

But I would like the Selenium tests to use the Firefox instance on the other host. Is that possible?

Answer

Master Azazel picture Master Azazel · Nov 21, 2016

Selenium Standalone Server

The Selenium Server is needed in order to run Remote Selenium WebDriver.