2016-03-21 39 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

這將在未來幾周合併。