Skip to content

Added conditional for WebDriver in 'screenshotElement' method. (#2) #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,17 @@ class ResembleHelper extends Helper {
await el.screenshot({
path: configuration.screenshotFolder + name + '.png'
});
}
else throw new Error("Method only works with Puppeteer");
} else if (this.helpers['WebDriver']) {
const configuration = this.config;

await helper.waitForVisible(selector);
const els = await helper._locate(selector);
if (!els.length) throw new Error(`Element ${selector} couldn't be located`);
const el = els[0];

await el.saveScreenshot(configuration.screenshotFolder + name + '.png');
}
else throw new Error("Method only works with Puppeteer and WebDriver helpers.");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "codeceptjs-resemblehelper",
"version": "1.6.0",
"version": "1.7.0",
"description": "Resemble Js helper for CodeceptJS, with Support for Webdriver, Puppeteer & Appium",
"repository": {
"type": "git",
Expand Down