【问题标题】:Webdriver.io - can not get firefox to runWebdriver.io - 无法让 firefox 运行
【发布时间】:2020-02-28 02:37:27
【问题描述】:

我正在尝试让 firefox 在 webdriver.io 5 中运行。这是在 Linux 云上。

我明白了:

2020-02-28T02:32:33.472Z INFO @wdio/cli:launcher: Run onPrepare hook
2020-02-28T02:32:33.475Z INFO @wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2020-02-28T02:32:33.818Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in firefox - /build/main.js
[0-0] 2020-02-28T02:32:33.881Z INFO webdriverio: Initiate new session using the webdriver protocol
[0-0] 2020-02-28T02:32:33.883Z INFO webdriver: [POST] http://127.0.0.1:4444/session
[0-0] 2020-02-28T02:32:33.883Z INFO webdriver: DATA {
  capabilities: {
    alwaysMatch: { browserName: 'firefox', 'moz:firefoxOptions': [Object] },
    firstMatch: [ {} ]
  },
  desiredCapabilities: { browserName: 'firefox', 'moz:firefoxOptions': { args: [Array] } }
}
[0-0] 2020-02-28T02:32:33.899Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:4444
[0-0] 2020-02-28T02:32:33.899Z INFO webdriver: Retrying 1/3

这是我的配置:

exports.config = {
    runner: 'local',
    path: '/',
    specs: [
        './build/**/*.js'
    ],
    maxInstances: 10,
    capabilities: [
      {   
          "browserName": "firefox",
          "moz:firefoxOptions": {
            "args": ["-headless"],
          }
      }
    ],
    logLevel: 'info',
    bail: 0,
    baseUrl: 'http://localhost',
    waitforTimeout: 10000,
    connectionRetryTimeout: 90000,
    connectionRetryCount: 3,
    reporters: ['spec'],
    framework: 'mocha',
    mochaOpts: {
        ui: 'bdd',
        timeout: 60000
    },
    services: [
    ],
}```

Any ideas what I am doing wrong? 

【问题讨论】:

  • 你是在使用 selenium 服务器还是你是如何触发 gecko 驱动的?
  • 如果我使用无头 Firefox 是否需要 selenium?
  • 这是您可以做出的选择。请参阅可用的样板。

标签: selenium testing selenium-webdriver webdriver webdriver-io


【解决方案1】:

path 应设置为 path: "/wd/hub",您的服务似乎为空。您可以通过两种不同的方式将 webdriverio 与 mocha 结合使用。含硒或不含硒。

请参考官方文档here的样板

【讨论】:

    【解决方案2】:
    [0-0] 2020-02-28T02:32:33.899Z WARN webdriver: Request failed due to connect ECONNREFUSED 127.0.0.1:4444
    

    如果您使用 selenium-standalone,请确保您的机器上同时安装了 java jdk 和 sdk。让我知道这是否适合你。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-03-21
      • 2016-07-15
      • 1970-01-01
      • 2016-05-06
      • 2019-02-18
      • 2014-03-05
      • 2018-02-08
      相关资源
      最近更新 更多