Codeception - Can't connect to Webdriver (Acceptance Test)

半腔热情 提交于 2021-02-09 09:20:44

问题


I can access url and create sessions:

http://localhost:4444/wd/hub/static/resource/hub.html

but when i execute ./codecept run i get an error, but i have Selenium Server running:

[ConnectionException] Can't connect to Webdriver at http://127.0.0.1:4444/wd/hub. Please make sure that Selenium Server or PhantomJS is running.

To execute Selenium Server, i used this command:

java -Dwebdriver.gecko.driver=./geckodriver -jar "selenium-server-standalone-3.12.0.jar"

I tried too with IE and Chrome (i have the same problem too):

java -Dwebdriver.chrome.driver=./chromedriver -jar "selenium-server-standalone-3.12.0.jar"
java -Dwebdriver.ie.driver=./IEDriverServer -jar "selenium-server-standalone-3.12.0.jar"

acceptance.suite.yml

class_name: AcceptanceTester
modules:
    enabled:
        - WebDriver
        - \Helper\Acceptance
    config:
        WebDriver:
            url: 'http://localhost'
            browser: firefox
            window_size: 820x1000
  • Codeception Version: 2.4.1
  • WebDriver Chrome Version: 2.38 (win32)
  • WebDriver Firefox Version: 0.20.1 (x64)
  • Chrome Version: 66.0.3359.139 (64-bit)
  • Firefox Version: Firefox Quantum 60.0 (64-bit)
  • Windows Version: Windows 8.1 64bit
  • Selenium Version: 3.12.0

回答1:


To start Selenium Server you need not require to pass/specify the WebDriver variant and you can start the Selenium Server as follows :

  • Command :

    >java -jar selenium-server-standalone-3.12.0.jar
    
  • Console Logs :

    C:\Utility\selenium-server-standalone>java -jar selenium-server-standalone-3.12.0.jar
    15:28:28.249 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.12.0', revision: '7c6e0b3'
    15:28:28.251 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
    2018-05-11 15:28:28.361:INFO::main: Logging initialized @467ms to org.seleniumhq.jetty9.util.log.StdErrLog
    15:28:28.860 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
    
  • Snapshot of the Resource Hub :


Update

As per the documentation at codeception.com the acceptance.suite.yml should have been as follows :

modules:
    enabled:
    - WebDriver:
       url: 'http://localhost/'
       browser: firefox
       window_size: 820x1000



回答2:


Problem fixed. I was using proxy.

For future users with same problem like me, can follow the steps.

  • First, check if you have proxy defined with this command:

echo %http_proxy%

  • If return some result, you need set a empty proxy with this command:

set http_proxy=

You need define a proxy always you are opening a new command line.



来源:https://stackoverflow.com/questions/50289384/codeception-cant-connect-to-webdriver-acceptance-test

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!