我知道这是一个基本问题,但我就是不能解决它。
我下载了样例宁静项目(mvn archetype serenity-junit-screenplay-archetype) (https://www.youtube.com/watch?v=o-6CcDFn5Ug),在谷歌上搜索"BDD in Action“。
我正在使用Gradle进行构建编译:
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我已经按如下方式更新了"SearchByKeywordStory“,以包含IEDriver和ChromeDriver的"webdriver.driver”属性:
@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\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BFCACHE的注册表值)
我可以看到IE浏览器被调用(启动Internet Explorer...等等),但它在那之后立即失败。
我确信IEDriver是可以工作的,因为我还有其他几个Selenium maven项目,它们有上百个测试,调用InternetExplorer都没有问题。
如果我做错了什么,请让我知道。
发布于 2016-06-24 08:18:12
您是否尝试过将IE驱动程序版本升级到2.53.0?
https://stackoverflow.com/questions/37953433
复制相似问题