首页 > 解决方案 > 如何使用谷歌浏览器在无头模式下运行 botium-cli

问题描述

如何使用 chrome 浏览器在无头模式下运行 botium-cli + botium-webdriver-connector?

该网页不适用于 phantomjs 浏览器


编辑:弗洛里安回答有效,我在 ubuntu 上运行 jenkins,还需要添加 --no-sanbox 和 --disable-dev-shm-usage 选项

我的最终配置

"WEBDRIVERIO_OPTIONS": {
    "desiredCapabilities": {
        "browserName": "chrome",
        "chromeOptions": {
            "args": [ "--headless", "--no-sandbox", "--disable--dev-shm-usage" ]
        } 
    }
}

标签: automated-testschatbot

解决方案


在无头模式下使用 Chrome 可以使用 Botium 示例:https ://github.com/codeforequity-at/botium-connector-webdriverio/blob/master/samples/botbuilderwebchat/

在 botium.json 中,webdriver 选项应该设置如下:

  "WEBDRIVERIO_OPTIONS": {
    "desiredCapabilities": {
      "browserName": "chrome",
      "chromeOptions": {
        "args": [ "--headless" ]
      }          
    }
  },

推荐阅读