Closed laughinghan closed 7 years ago
I'm looking for this too.
@laughinghan @mroien
const webdriverio = require('webdriverio');
const webdriverioScreenshot = require('wdio-screenshot');
const client = webdriverio.remote(...);
webdriverioScreenshot.init(client);
client.init();
@zinserjan should it be mentioned in readme? Is PR needed?
No, the part about webdriverioScreenshot.init(client);
is in the README.
@mroien where? Also there is a PR about updating the readme https://github.com/zinserjan/wdio-screenshot/pull/59
Oh I'm sorry you're right it's was on the wdio-element-screenshot readme
@kisenka @mroien At the moment this library is only supposed to work with webdriverio's testrunner.
There is no official support for standalone mode as there are no tests for standalone mode yet and the current solution or workaround for standalone just exists due to webdriverio's plugin API expect a method called init
.
Ideally, the following examples should work without any further workarounds:
// single browser
const webdriverio = require('webdriverio');
const webdriverioScreenshot = require('wdio-screenshot');
const client = webdriverio.remote(...);
webdriverioScreenshot.init(client);
client.init();
// multi browser
const webdriverio = require('webdriverio');
const webdriverioScreenshot = require('wdio-screenshot');
const client = webdriverio.multiremote({
myChromeBrowser: {
desiredCapabilities: {
browserName: 'chrome'
}
},
myFirefoxBrowser: {
desiredCapabilities: {
browserName: 'firefox'
}
}
});
webdriverioScreenshot.init(client);
client.init();
But the latter doesn't as the init method seems to be wrong for multiremote. Also multiremote should work with testrunner out of the box without the ugly workaround suggested by @blindedByCode in https://github.com/zinserjan/wdio-screenshot/issues/42#issuecomment-277560304
I'm happy to accept a PR that add some tests for this and makes sure that also multiremote works in standalone or testrunner mode.
So, I'm not sure if this corresponds to the question asked, but I forked this project and did some very minor tweaking in order to use this with standalone mode: https://github.com/maggiesavovska/wdio-screenshot
My script
require()
s WebdriverIO rather than using the testrunner, apparently called "Standalone Mode": http://webdriver.io/guide/getstarted/modes.htmlThe instructions in the README for
wdio-screenshot
mentionwdio.config.js
, but that appears to be only for the testrunner. Doingrequire('webdriverio').remote({desiredCapabilities: {...}, plugins: {'wdio-screenshot': {}}})
results in an object without the.saveDocumentScreenshot()
method. Does this only work with the testrunner?