Selenium Codeception-Can';t连接到Webdriver(验收测试)

Selenium Codeception-Can';t连接到Webdriver(验收测试),selenium,selenium-webdriver,webdriver,selenium-chromedriver,codeception,Selenium,Selenium Webdriver,Webdriver,Selenium Chromedriver,Codeception,我可以访问url并创建会话: 但是当我执行/codecept run时,我得到一个错误,但是我让Selenium服务器运行: [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. 为了执行Selenium Server,我使用了以下命令: java -Dwe

我可以访问url并创建会话:

但是当我执行
/codecept run
时,我得到一个错误,但是我让Selenium服务器运行:

[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.

为了执行Selenium Server,我使用了以下命令:

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

我也尝试过IE和Chrome(我也有同样的问题):

接受.suite.yml

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

要启动Selenium服务器,无需通过/指定WebDriver变量,您可以按如下方式启动Selenium服务器

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

    >java -jar selenium-server-standalone-3.12.0.jar
    
  • 控制台日志:

    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
    
  • 资源中心的快照:


更新 根据
acceptance.suite.yml
上的文件,应如下所示:

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

问题解决了我正在使用代理。

对于像我这样有同样问题的未来用户,可以按照以下步骤操作

  • 首先,检查是否使用以下命令定义了代理:
echo%http\u proxy%

  • 如果返回某些结果,则需要使用以下命令设置空代理:
set http\u proxy=


您需要在打开新命令行时始终定义代理。

通过您的示例,我也可以访问该链接,但在执行codeception时,我会遇到相同的错误。@Juan.Queiroz签出我的答案更新并让我知道相同的情况。:(需要url-启动应用程序的url。需要浏览器-要启动的浏览器。主机-Selenium服务器主机(默认为127.0.0.1)。端口-Selenium服务器端口(默认为4444).From:@Juan.Queiroz检查我的更新答案,并让我知道答案status@Juan.Queiroz请签出我的更新答案,并让我知道此处遇到相同问题的状态。代理解决方案对我不起作用。当我运行测试时,我收到一个错误,远程响应的JSON解码失败:“请求的资源\/wd/hub/session\在此服务器上找不到。”