selenium-webdriverwebdriver-iochimp.js

struggling to launch other browsers with Chimp / Webdriver


Edit - solved my issue, see the added detail. selecting the one answer because it was helpful and on point, even if not my direct issue

Q:

I'm following https://chimp.readme.io/docs/tutorial. I can get everything to happen as expected, but when I try to work with a separate browser - say firefox - I seem to only be able to launch it from the commandline. I am trying to see How/If I can start it from code...

I've dug around but I can't seem to find a code implementation of the same functionality, am I crazy?

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

resolved:

in the "dang that was dumb" category:

I was trying to launch chimp multiple times at different times (Crontab jobs). But since I was calling it with $chimp --watch the hooks and setup would get messed up (chimp would stay alive with the --watch) If you want to call different browsers consider using different commandline args, like chimp --browser=firefox instead of tweaking files.. makes it easier.


Solution

  • If you are trying to use 2 browsers at the same time, try to use the MutliDriver branch.

    This will be merged in the coming weeks.