2015-09-20 68 views
0

我正在使用python與硒webdriver來運行和自動化網格上的測試用例。我可以在集線器和節點上啓動FIREFOX瀏覽器併發出一些警告消息,但它工作正常。但問題是使用CHROME啓動相同的Web應用程序。我嘗試了一切可能,但沒有幫助。 每當我必須從本地CHROME瀏覽器開始,我曾經運行chromedriver.exe來啓動應用程序。但我不知道如何遠程解析chromedriver.exe以啓動相同的應用程序。我甚至嘗試安裝並開始運行的節點上的chromedriver並檢查F IT開始運行,但它並沒有help.And已經設置了系統屬性爲好...無法使用硒webdriver遠程運行CHROME

java -jar ./selenium-server-standalone-2.35.0.jar - Dwebdriver.chrome.driver='/opt/drivers/chromedriver' -role webdriver -hub http://192.168.1.10:4444/grid/register -port 5566 -browser browserName=chrome 

輸出:

====================================================================== 
ERROR: test_search_in_python_org (__main__.PythonOrgSearch) 
---------------------------------------------------------------------- 
Traceback (most recent call last): 
    File "C:\Python27\bharath.py", line 13, in setUp 
    self.driver = webdriver.Remote('http://192.168.1.62:4444/wd/hub',DesiredCapabilities.CHROME) 
    File "C:\Python27\lib\site-packages\selenium-2.47.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 87, in __init__ 
    self.start_session(desired_capabilities, browser_profile) 
    File "C:\Python27\lib\site-packages\selenium-2.47.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 136, in start_session 
    'desiredCapabilities': desired_capabilities, 
    File "C:\Python27\lib\site-packages\selenium-2.47.1-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 196, in execute 
    self.error_handler.check_response(response) 
    File "C:\Python27\lib\site-packages\selenium-2.47.1-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 181, in check_response 
    raise exception_class(message, screen, stacktrace) 
WebDriverException: Message: The driver executable does not exist: C:\Users\user\'C:\Users\user\Desktop\chromedriver.exe' 
Stacktrace: 
    at com.google.common.base.Preconditions.checkState (Preconditions.java:197) 
    at org.openqa.selenium.remote.service.DriverService.checkExecutable (DriverService.java:121) 
    at org.openqa.selenium.remote.service.DriverService.findExecutable (DriverService.java:116) 
    at org.openqa.selenium.chrome.ChromeDriverService.access$0 (ChromeDriverService.java:1) 
    at org.openqa.selenium.chrome.ChromeDriverService$Builder.findDefaultExecutable (ChromeDriverService.java:137) 
    at org.openqa.selenium.remote.service.DriverService$Builder.build (DriverService.java:290) 
    at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService (ChromeDriverService.java:88) 
    at org.openqa.selenium.chrome.ChromeDriver.<init> (ChromeDriver.java:138) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0 (NativeConstructorAccessorImpl.java:-2) 
    at sun.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:57) 
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45) 
    at java.lang.reflect.Constructor.newInstance (Constructor.java:526) 
    at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor (DefaultDriverProvider.java:103) 
    at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance (DefaultDriverProvider.java:97) 
    at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance (DefaultDriverFactory.java:60) 
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call (DefaultSession.java:222) 
    at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call (DefaultSession.java:1) 
    at java.util.concurrent.FutureTask.run (FutureTask.java:262) 
    at org.openqa.selenium.remote.server.DefaultSession$1.run (DefaultSession.java:176) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run (Thread.java:745) 

---------------------------------------------------------------------- 
Ran 1 test in 1.310s 

FAILED (errors=1) 

請幫我在這裏...

回答

0

這個問題似乎是你試圖打開錯誤的位置指向該文件:

WebDriverException: Message: The driver executable does not exist: 
    C:\Users\user\'C:\Users\user\Desktop\chromedriver.exe' Stacktrace: 

順便說一句不清楚爲什麼你想,如果你使用Python開始chromedriver用java ..

如果你正在使用Python,你可以檢查此: test suite python - webdriver

最好的問候 Claudio

+0

因爲我正在運行一個硒網格。 –

+0

chromedriver安裝在網格上的集線器和節點上。因爲我必須啓動司機;我不確定是否必須在Node或Hub上運行它。我嘗試了兩種方式,但它不起作用! –