Selenium Webdriver (node.js) take screenshot and save test results

For saving the test logs you typically use a test runner. When you check if an element is on the page and you can’t find it then you raise an exception (typically an assertion error) and the test runner will record this and mark it as a failed test. In the documentation they suggest you use Mocha.

As for saving a screenshot to disk, the the api looks like this

driver.takeScreenshot().then(
    function(image, err) {
        require('fs').writeFile('out.png', image, 'base64', function(err) {
            console.log(err);
        });
    }
);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)