如何在ChromeDriver中使用Arquillian Graphene 2

时间:2016-08-10 09:40:15

标签: jboss-arquillian arquillian-drone graphene2

如何在不同浏览器(例如Chrome)中使用Graphene 2? (默认的htmlUnit对我来说效果不好。)

让Wildfly 8.1服务器在Arquillian容器内运行,我想使用Drone + Graphene来执行实际测试。

@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());
}

我尝试将此添加到arquillian.xml配置中(没有运气):

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

结束时:

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

我是否真的需要以某种方式将Chrome二进制文件嵌入到我的项目中?

1 个答案:

答案 0 :(得分:3)

您不必将其嵌入到项目中,但Chrome的驱动程序不随浏览器本身一起提供。您必须下载并使用配置文件中的chromeDriverBinary将Graphene指向其位置。