Created
July 2, 2016 21:38
-
-
Save lorenzo/dd8276e817c7084102530d6de503286d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webdriverio = require('webdriverio'); | |
var elm = require('./main.js'); | |
var options = { | |
desiredCapabilities: { | |
browserName: 'firefox' | |
} | |
}; | |
var sessions = new WeakMap; | |
var main = elm.Main.worker(); | |
function subscribe(program) { | |
program.ports.init.subscribe(function url() { | |
var client = webdriverio.remote(options).init(); | |
sessions.set(program, client); | |
console.log('init'); | |
}); | |
program.ports.url.subscribe(function subscribe(url) { | |
sessions.get(program).url(url).saveScreenshot("foo.png"); | |
console.log('url'); | |
}); | |
program.ports.close.subscribe(function close() { | |
sessions.get(program).close(); | |
console.log('close'); | |
}); | |
} | |
subscribe(main); | |
setTimeout(function(){ main.ports.begin.send("Begin"); }, 0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment