努力使用 Chimp / Webdriver 启动其他浏览器

struggling to launch other browsers with Chimp / Webdriver

编辑 - 解决了我的问题,请参阅添加的详细信息。选择一个答案是因为它很有帮助而且很重要,即使这不是我的直接问题

问:

我正在关注 https://chimp.readme.io/docs/tutorial。我可以让一切按预期发生,但是当我尝试使用单独的浏览器(比如 firefox)时,我似乎只能从命令行启动它。我正在尝试查看 How/If 我可以从代码开始...

我四处寻找,但似乎找不到相同功能的代码实现,我疯了吗?

// I've tried to add the following code to the step_def.js , inside and outside of module.exports = function()

var webdriverio = require('webdriverio');
var options = {
    desiredCapabilities: {
        browserName: 'firefox'
    }
};

webdriverio
    .remote(options)
    .init()
    .url('http://www.google.com')
    .title(function(err, res) {
        console.log('Title was: ' + res.value);
    })
    .end();


// but the output I get tells me something is wrong:

[chimp] Detected an unhandledRejection.
[chimp][hooks] Reason:
[chimp][hooks] RuntimeError
[chimp][hooks] Couldn't connect to selenium server

已解决:

在 "dang that was dumb" 类别中:

我试图在不同时间多次启动 chimp(Crontab 作业)。但是因为我用 $chimp --watch 调用它,钩子和设置会搞砸(黑猩猩会用 --watch 活着) 如果你想调用不同的浏览器,考虑使用不同的命令行参数,比如 chimp --browser=firefox 而不是调整文件.. 使它更容易。

如果您尝试同时使用 2 个浏览器,请尝试使用 MutliDriver branch

这将在未来几周内合并。