jboss-arquillianarquillian-dronegraphene2

How to use Arquillian Graphene 2 with ChromeDriver


How do I use Graphene 2 with different browsers such as Chrome? (Default htmlUnit does not work well for me.)

Having Wildfly 8.1 server running inside Arquillian container, I'd like to use Drone + Graphene to execute actual tests.

@Drone
WebDriverdriver;

...

@RunAsClient
@Test
@InSequence(1)
public void basicHomepageTest() {

    // try to get the homepage
    driver.get("http://localhost:8080/superapp");

    // read title and source
    Assert.assertEquals("My Super App", driver.getTitle());

    // read content
    System.out.println("Page source -----");
    System.out.println(driver.getPageSource());
}

I tried adding this to arquillian.xml config (with no luck):

<extension qualifier="webdriver">
    <property name="browser">chrome</property>
</extension>

Ending up with:

java.lang.RuntimeException: Unable to instantiate Drone via org.openqa.selenium.chrome.ChromeDriver(Capabilities): java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/se
    lenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleapis.com/index.html
    Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.chrome.driver system property; for more information, see https://github.com/SeleniumHQ/selenium/wiki/ChromeDriver. The latest version can be downloaded from http://chromedriver.storage.googleap
    is.com/index.html

Do I really need to embed Chrome binaries into my project somehow?


Solution

  • You don't have to embed it into your project per se, but the driver for Chrome is not shipped with the browser itself. You will have to download it and point Graphene to its location using chromeDriverBinary in your config file.