0

我将 Serenity 与 JBehave 一起使用。为了配置要启动的驱动程序,我使用“serenity.properties”文件和驱动程序的标准宁静属性

webdriver.driver=iexplorer
webdriver.chrome.driver=Drivers/chromedriver.exe
webdriver.ie.driver=Drivers\IEDriverServer.exe

当我将 webdriver.driver 属性设置为“firefox”或“chrome”时,一切正常并且测试按预期运行。但是当我尝试使用 IE 浏览器时没有打开,我得到一个异常:

ERROR net.thucydides.core.webdriver.WebDriverFacade - FAILED TO CREATE NEW WEBDRIVER_DRIVER INSTANCE class org.openqa.selenium.ie.InternetExplorerDriver: Could not instantiate class org.openqa.selenium.ie.InternetExplorerDriver
net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate class org.openqa.selenium.ie.InternetExplorerDriver
    at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:209)<br>
    at net.thucydides.core.webdriver.WebDriverFacade.newDriverInstance(WebDriverFacade.java:142)<br>
    at net.thucydides.core.webdriver.WebDriverFacade.newProxyDriver(WebDriverFacade.java:133)<br>
    at net.thucydides.core.webdriver.WebDriverFacade.getProxiedDriver(WebDriverFacade.java:103)<br>
    at net.thucydides.core.webdriver.WebDriverFacade.openIgnoringHtmlUnitScriptErrors(WebDriverFacade.java:178)<br>
    at net.thucydides.core.webdriver.WebDriverFacade.get(WebDriverFacade.java:173)<br>
    at ua.dataart.pages.LoginPage.openBaseUrl(LoginPage.java:59)<br>
    at ua.dataart.steps.serenity.RegistrationSteps.regPage_is_opened(RegistrationSteps.java:20)<br>
    at ua.dataart.steps.serenity.RegistrationSteps$$EnhancerByCGLIB$$76672e1c.CGLIB$regPage_is_opened$3(<generated>)<br>
    at ua.dataart.steps.serenity.RegistrationSteps$$EnhancerByCGLIB$$76672e1c$$FastClassByCGLIB$$dcecc188.invoke(<generated>)<br>
    at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)<br>
    at net.thucydides.core.steps.StepInterceptor.invokeMethod(StepInterceptor.java:369)<br>
    at net.thucydides.core.steps.StepInterceptor.executeTestStepMethod(StepInterceptor.java:354)<br>
    at net.thucydides.core.steps.StepInterceptor.runTestStep(StepInterceptor.java:329)<br>
    at net.thucydides.core.steps.StepInterceptor.testStepResult(StepInterceptor.java:134)<br>
    at net.thucydides.core.steps.StepInterceptor.intercept(StepInterceptor.java:61)<br>
    at ua.dataart.steps.serenity.RegistrationSteps$$EnhancerByCGLIB$$76672e1c.regPage_is_opened(<generated>)<br>
    at ua.dataart.steps.RegistrationAndLoginSteps.registrationPageIsOpened(RegistrationAndLoginSteps.java:54)<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)<br>
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)<br>
    at java.lang.reflect.Method.invoke(Method.java:498)<br>
    at org.jbehave.core.steps.StepCreator$ParametrisedStep.perform(StepCreator.java:599)<br>
    at org.jbehave.core.embedder.PerformableTree$FineSoFar.run(PerformableTree.java:340)<br>
    at org.jbehave.core.embedder.PerformableTree$PerformableSteps.perform(PerformableTree.java:1072)<br>
    at org.jbehave.core.embedder.PerformableTree$AbstractPerformableScenario.performRestartableSteps(PerformableTree.java:938)<br>
    at org.jbehave.core.embedder.PerformableTree$NormalPerformableScenario.perform(PerformableTree.java:977)<br>
    at org.jbehave.core.embedder.PerformableTree$PerformableScenario.perform(PerformableTree.java:887)<br>
    at org.jbehave.core.embedder.PerformableTree$PerformableStory.performScenarios(PerformableTree.java:811)<br>
    at org.jbehave.core.embedder.PerformableTree$PerformableStory.perform(PerformableTree.java:784)<br>
    at org.jbehave.core.embedder.PerformableTree.performCancellable(PerformableTree.java:416)<br>
    at org.jbehave.core.embedder.PerformableTree.perform(PerformableTree.java:387)<br>
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:291)<br>
    at org.jbehave.core.embedder.StoryManager$EnqueuedStory.call(StoryManager.java:265)<br>
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)<br>
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)<br>
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)<br>
    at java.lang.Thread.run(Thread.java:745)<br>
**Caused by: java.lang.IllegalStateException: The path to the driver executable must be set by the webdriver.ie.driver system property;** <br>
for more information, see https://github.com/SeleniumHQ/selenium/wiki/InternetExplorerDriver. <br>
The latest version can be downloaded from http://selenium-release.storage.googleapis.com/index.html<br>
    at com.google.common.base.Preconditions.checkState(Preconditions.java:197)<br>
    at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:109)<br>
    at org.openqa.selenium.ie.InternetExplorerDriverService.access$000(InternetExplorerDriverService.java:32)<br>
    at org.openqa.selenium.ie.InternetExplorerDriverService$Builder.findDefaultExecutable(InternetExplorerDriverService.java:167)<br>
    at org.openqa.selenium.remote.service.DriverService$Builder.build(DriverService.java:296)<br>
    at org.openqa.selenium.ie.InternetExplorerDriver.setupService(InternetExplorerDriver.java:251)<br>
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:172)<br>
    at org.openqa.selenium.ie.InternetExplorerDriver.<init>(InternetExplorerDriver.java:150)<br>
    at net.thucydides.core.webdriver.WebdriverInstanceFactory.newInternetExplorerDriver(WebdriverInstanceFactory.java:123)<br>
    at net.thucydides.core.webdriver.WebDriverFactory.internetExplorerDriver(WebDriverFactory.java:564)<br>
    at net.thucydides.core.webdriver.WebDriverFactory.newWebdriverInstance(WebDriverFactory.java:188)<br>
    ... 37 more
Given user is on the registration page (FAILED)<br>
(net.thucydides.core.webdriver.UnsupportedDriverException: Could not instantiate class org.openqa.selenium.ie.InternetExplorerDriver)<br>

我为我的 Selenium 测试使用相同的 IE 驱动程序,并进行了一些功能设置,它工作正常。

各种帮助将不胜感激。

4

0 回答 0