我是Serenity Bdd框架的新手;我克隆了这个回购:https://github.com/serenity-bdd/serenity-screenplay-train-demo
Os: Ubuntu: 17.04
Intellij IDEA Community 2017.3
Pom.xml: https://github.com/serenity-bdd/serenity-screenplay-train-demo/blob/master/pom.xml
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-core</artifactId>
<version>${serenity.version}</version>
</dependency>
<dependency>
<groupId>net.serenity-bdd</groupId>
<artifactId>serenity-screenplay</artifactId>
<version>${serenity.version}</version>
</dependency>
我正在尝试运行自动化测试但遇到错误:
net.thucydides.core.webdriver.UnsupportedDriverException:
Could not instantiate class org.openqa.selenium.chrome.ChromeDriver
.
.
.
Caused by: net.thucydides.core.webdriver.UnsupportedDriverException: Could
not instantiate new WebDriver instance of type class
org.openqa.selenium.chrome.ChromeDriver (The path to the chromedriver driver
executable must be set by the webdriver.chrome.driver system property; for
more information, see
https://sites.google.com/a/chromium.org/chromedriver/downloads. The latest
version can be downloaded from
https://sites.google.com/a/chromium.org/chromedriver/downloads
.
.
.
.
Caused by: java.lang.IllegalStateException: The path to the chromedriver
driver executable must be set by the webdriver.chrome.driver system
property; for more information, see
https://sites.google.com/a/chromium.org/chromedriver/downloads. The latest
version can be downloaded from
https://sites.google.com/a/chromium.org/chromedriver/downloads
我知道我缺少一些罐子或库但不知道如何添加它们或添加什么。 我猜我应该更新maven pom.xml以添加缺少的依赖项?
更新
原来 pom.xml
指向较旧的库版本,所以我更新了它们,现在又出现了这个新错误:
ERROR n.t.core.webdriver.WebDriverFacade - 未能创建新的 WEBDRIVER_DRIVER INSTANCE类 org.openqa.selenium.chrome.ChromeDriver:无法实例化新的 WebDriver类型类的实例 org.openqa.selenium.chrome.ChromeDriver(chromedriver的路径) 驱动程序可执行文件必须由webdriver.chrome.driver系统设置 属性;有关更多信息,请参阅 https://sites.google.com/a/chromium.org/chromedriver/downloads。该 最新版本可以从中下载 https://sites.google.com/a/chromium.org/chromedriver/downloads
答案 0 :(得分:1)
消息&#34;未能创建新的WEBDRIVER_DRIVER实例&#34;意味着Selenium无法连接到WebDriver。消息的其余部分(&#34; chromedriver驱动程序可执行文件的路径必须由webdriver.chrome.driver系统属性设置...&#34;)解释您需要做什么。您需要下载最新的chromedriver可执行文件并将其放在系统路径上。 Serenity会为你设置webdriver.chrome.driver属性 - 不要,重复不要,在你的测试类或你的属性文件中硬编码这个路径(硬编码chromedriver路径是一个常见但非常错误的反模式,因为它使你的测试非常不可移植)。