2014-09-03 66 views
0

我試圖運行我對鉻的測試,但是鉻被觸發,而不導航到該get()方法在這裏有波紋管的網址是我的代碼:硒的webdriver觸發Chrome,但沒有打開獲取URL

public void startSelenium() throws MalformedURLException { 

     driver = getDriverInstance("http://localhost:4444/wd/hub", "chrome"); 

    } 

    public WebDriver getDriverInstance(
             String Url, 
             String browser) throws MalformedURLException { 

     WebDriver driver = null; 
     URL url = new URL(Url); 
     if(browser.equals("firefox")) { 
      DesiredCapabilities capability = DesiredCapabilities.firefox(); 
      driver = new RemoteWebDriver(url, capability); 
     } else if(browser.equals("chrome")) { 
      DesiredCapabilities capability = DesiredCapabilities.chrome(); 
      driver = new RemoteWebDriver(url, capability); 
     } else if(browser.equals("IE")) { 
      DesiredCapabilities capability = DesiredCapabilities.internetExplorer(); 
      driver = new RemoteWebDriver(url, capability); 
     } 
     return driver; 
    } 

,這裏是繼承上述方法

driver.get("http://www.facebook.com"); 

,這裏是我的獨立服務器的配置類

java -jar selenium-server-standalone-2.42.2.jar -Dwebdriver.chrome.driver="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" 

but the window is open and the get method is not executed. and this is the error that i have got in my eclips 

org.openqa.selenium.WebDriverException: Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:30' 
System info: host: 'CON0389', ip: '10.201.10.78', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_45' 
Driver info: org.openqa.selenium.remote.RemoteWebDriver 
    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.ErrorHandler.createThrowable(ErrorHandler.java:204) 
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156) 
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599) 
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:153) 
    at concep.selenium.core.GenericSeleniumWebDriver.getDriverInstance(GenericSeleniumWebDriver.java:73) 
    at concep.selenium.core.GenericSeleniumWebDriver.startSelenium(GenericSeleniumWebDriver.java:58) 
    at concep.selenium.Dynamic.DynamicBase.startSelenium(DynamicBase.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:84) 
    at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:564) 
    at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:213) 
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:653) 
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901) 
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231) 
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127) 
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111) 
    at org.testng.TestRunner.privateRun(TestRunner.java:767) 
    at org.testng.TestRunner.run(TestRunner.java:617) 
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:334) 
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329) 
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291) 
    at org.testng.SuiteRunner.run(SuiteRunner.java:240) 
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) 
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) 
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224) 
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1149) 
    at org.testng.TestNG.run(TestNG.java:1057) 
    at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111) 
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204) 
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175) 
Caused by: java.util.concurrent.TimeoutException 
    at java.util.concurrent.FutureTask.get(Unknown Source) 
    at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:130) 
    at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:79) 
    at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:163) 
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:62) 
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:572) 
    at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:240) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:126) 
    at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:139) 
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:171) 
    at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139) 
    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.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59) 
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:53) 
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:54) 
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:215) 
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1) 
    at java.util.concurrent.FutureTask.run(Unknown Source) 
    at org.openqa.selenium.remote.server.DefaultSession$1.run(DefaultSession.java:169) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
    at java.lang.Thread.run(Unknown Source) 

回答

1

我已經解決了這個問題,事實證明,我已經下載了舊版本的IEWebdriverServer,所以我只需更新它並更新我的IE並將它們包含在路徑中,並且一切正常。