2016-03-21 69 views
0

编辑 - 解决了我的问题,看到添加的细节。选择一个答案,因为它是有益的和上来看,即使不是我的直接问题努力推出其他浏览器与黑猩猩/ Webdriver

问:

我下面https://chimp.readme.io/docs/tutorial。我可以让所有事情按预期发生,但是当我尝试使用单独的浏览器(比如说firefox)时,我似乎只能从命令行启动它。我想看如何/如果我可以从代码启动它...

我挖了但我似乎无法找到相同功能的代码实现,我疯了吗?

// 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 

解决:

在 “党,这是愚蠢的” 类别:

我试图在不同的时间(crontab作业)推出黑猩猩多次。但是因为我用$chimp --watch来调用它,挂钩和设置会变得混乱(黑猩猩会在--watch中保持活跃) 如果你想调用不同的浏览器,考虑使用不同的命令行参数,比如chimp --browser = firefox,而不是调整文件..使其更容易。

回答

0

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

这将在未来几周合并。