使用driver.get()启动URL后的org.openqa.selenium.WebDriverException

时间:2017-07-04 12:21:27

标签: java selenium-webdriver ui-automation

启动URL后,

driver.get()会抛出org.openqa.selenium.WebDriverException。 我的网址采用以下格式 - https://qa-abc.google.abc.com

它适用于任何其他URL,但当我将数据更改为上述URL时,driver.get()启动URL然后抛出异常。

我正在使用Gecko Driver。我也可以直接启动网址。

任何解决方案?

**Code**

public static void InvokeApp(String browser, String url) {      

    try {           

        if(browser.equalsIgnoreCase("firefox")){

            System.setProperty("webdriver.gecko.driver", 
 "D:\\geckodriver.exe");

            driver = new FirefoxDriver();               



        //driver.manage().window().maximize();

        driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

        driver.get(url);   
    }


    } catch (Exception e) {         

        e.printStackTrace();

    }

}

public static void VerifyTitle(String title){

    try{        

        if (driver.getTitle().equalsIgnoreCase(title)){

            Reporter.reportStep("Page is successfully loaded :"+title, "PASS");             

        }else

            Reporter.reportStep("Page Title :"+driver.getTitle()+" did not match with :"+title, "FAIL");

    }catch (Exception e) {

        e.printStackTrace();

        Reporter.reportStep("The title did not match", "FAIL");
    }

}


**Exception Details-**

1499170417435   geckodriver INFO    Listening on 127.0.0.1:47524
1499170418556   geckodriver::marionette INFO    Starting browser C:\Program 
Files\Mozilla Firefox\firefox.exe with args ["-marionette"]
1499170422668   Marionette  INFO    Listening on port 51988
Jul 04, 2017 5:43:43 PM org.openqa.selenium.remote.ProtocolHandshake 
createSession
INFO: Detected dialect: W3C
org.openqa.selenium.WebDriverException: 
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Capabilities 
Session ID: 84657932-4128-4bfb-babd-56a2ba0eb399
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.createException(W3CHttpResponseCodec.java:150)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:115)
at org.openqa.selenium.remote.http.W3CHttpResponseCodec.decode(W3CHttpResponseCodec.java:45)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:164)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:82)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:637)
at org.openqa.selenium.remote.RemoteWebDriver.get(RemoteWebDriver.java:364)
at appModule.ReusableActions.InvokeApp(ReusableActions.java:76)
at utility.OpentapWrappers.beforeMethod(OpentapWrappers.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:104)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:515)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:217)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:590)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:851)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1177)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:756)
at org.testng.TestRunner.run(TestRunner.java:610)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:387)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:382)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
at org.testng.SuiteRunner.run(SuiteRunner.java:289)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1293)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1218)
at org.testng.TestNG.runSuites(TestNG.java:1133)
at org.testng.TestNG.run(TestNG.java:1104)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:236)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:81)
1499170483235   addons.productaddons    WARN    Failed downloading XML, status: 0, reason: error
1499170483704   addons.productaddons    WARN    Failed downloading via XHR, status: 0, reason: error

0 个答案:

没有答案