我知道這是一個基本的問題,但我只是無法解決它。如何調用IEDriver使用寧靜
我下載了樣本寧靜項目(mvn archetype serenity-junit-screenplay-archetype)(https://www.youtube.com/watch?v=o-6CcDFn5Ug)來搜索谷歌中的「BDD in Action」。
我使用搖籃爲我構建編譯:
的build.gradle
repositories {
jcenter()
mavenLocal()
}
buildscript {
repositories {
mavenLocal()
jcenter()
}
dependencies {
classpath("net.serenity-bdd:serenity-gradle-plugin:1.1.36")
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'net.serenity-bdd.aggregator'
dependencies {
compile 'net.serenity-bdd:serenity-core:1.1.36'
compile 'net.serenity-bdd:serenity-junit:1.1.36'
compile 'net.serenity-bdd:serenity-screenplay:1.1.36'
compile 'net.serenity-bdd:serenity-screenplay-webdriver:1.1.36'
testCompile('junit:junit:4.12')
compile('org.assertj:assertj-core:1.7.0')
compile('com.googlecode.lambdaj:lambdaj:2.3.3')
}
gradle.startParameter.continueOnFailure = true
我已經更新如下,以包括IEDriver和ChromeDriver了 「webdriver.driver」 屬性中的 「SearchByKeywordStory」:
@RunWith(SerenityRunner.class)
public class SearchByKeywordStory {
Actor anna = Actor.named("Anna");
@Managed(uniqueSession = true, clearCookies=BeforeEachTest)
public WebDriver herBrowser;
@Steps
OpenTheApplication openTheApplication;
@Before
public void annaCanBrowseTheWeb() {
System.setProperty("webdriver.ie.driver", "../resources/IEDriverServer.exe");
System.setProperty("webdriver.chrome.driver", "../resources/chromedriver.exe");
anna.can(BrowseTheWeb.with(herBrowser));
}
@Test
public void search_results_should_show_the_search_term_in_the_title() {
givenThat(anna).wasAbleTo(openTheApplication);
when(anna).attemptsTo(Search.forTheTerm("BDD In Action"));
then(anna).should(eventually(seeThat(TheWebPage.title(), containsString("BDD In Action"))));
}
}
我使用IntelliJ來執行我的方案。 Chromedriver完美無瑕地工作,測試通過。但IEDriver不起作用,當我運行測試時,出現以下錯誤:
SLF4J:未能加載類「org.slf4j.impl.StaticLoggerBinder」。 SLF4J:默認到無操作(NOP)記錄器執行
發起者InternetExplorerDriver服務器(32位) 2.48.0.0 端口聽力35996
net.thucydides.core.webdriver.UnsupportedDriverException:無法實例類org.openqa.selenium.ie.InternetExplorerDriver
net.thucydides.core.webdriver.UnsupportedDriverException:無法實例化類org.openqa.selenium.ie.InternetExplorerDriver
at org.ao.automation.tasks.OpenTheApplication.performAs(OpenTheApplication.java:15)
at org.ao.automation.features.search.SearchByKeywordStory.search_results_should_show_the_search_term_in_the_title(SearchByKeywordStory.java:43)
個
進程退出代碼爲-1
我在IE覈實了所有的設置(受保護的設置,縮放級別,從而HKEY_LOCAL_MACHINE \ SOFTWARE註冊表值\ Wow6432Node \微軟\的Internet Explorer \ MAIN \ FeatureControl \ FEATURE_BFCACHE)完成
我可以看到IE瀏覽器被調用(啓動Internet Explorer ... blah),但之後立即失敗。
我知道IEDriver的工作原理,因爲我有幾個其他的Selenium Maven項目有100多個測試,這些測試沒有調用InternetExplorer的問題。
請讓我知道如果我在這裏做錯了什麼。