Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

screenshot #55

Open
ComLock opened this issue Dec 21, 2015 · 1 comment
Open

screenshot #55

ComLock opened this issue Dec 21, 2015 · 1 comment

Comments

@ComLock
Copy link

ComLock commented Dec 21, 2015

This might be a really stupid question, but how to I access the driver/webdriver to make screenshot like suggested here: https://www.browserstack.com/automate/node#enhancements-screenshots

var fs = require('fs');

webdriver.WebDriver.prototype.saveScreenshot = function(filename) {
    return driver.takeScreenshot().then(function(data) {
        fs.writeFile(filename, data.replace(/^data:image\/png;base64,/,''), 'base64', function(err) {
            if(err) throw err;
        });
    })
};

driver.saveScreenshot('snapshot1.png');

Bonus question: Is it also possible to take screenshots of a css selector, not the whole page?

@randallb
Copy link

randallb commented Jul 4, 2016

I think Karma is the wrong tool for the job. Something like SeRunner seems more promising.

https://github.com/Hyddan/se-runner

Karma is for unit testing, which inherently wouldn't have screenshots.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants