无法使用selenium webdriver远程运行CHROME

时间:2015-09-20 20:35:35

标签: java python google-chrome selenium

我正在使用python和selenium webdriver来运行并自动化网格上的测试用例。我可以启动FIREFOX浏览器,在集线器和节点上都有一些警告消息,但它工作正常。但问题是使用CHROME启动相同的Web应用程序。我尝试了一切,但没有帮助。 每当我必须在本地开始使用CHROME浏览器时,我曾经运行chromedriver.exe来启动应用程序。但我不知道如何远程解析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 以在那里启动相同的应用程序。我甚至尝试安装并开始在节点上运行chromedriver并检查它是否开始运行但是它没有帮助。并且还设置了系统属性......

======================================================================
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)

输出:

php app/console debug:router

请帮帮我......

1 个答案:

答案 0 :(得分:0)

问题似乎是您尝试打开指向错误位置的文件:

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

顺便说一句,如果你正在使用python,你为什么要尝试用java启动chromedriver呢?

如果你正在使用python,你可以检查一下: test suite python - webdriver

最诚挚的问候 克劳迪奥