Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
125
rated 0 times [  129] [ 4]  / answers: 1 / hits: 33086  / 10 Years ago, tue, april 8, 2014, 12:00:00

I started developing tests for a website application and I have some problems.



I'm using Node.js, webdriver, chromedriver and selenium rc.



The questions are:
1. How do I make a screenshot and save it in the same folder as the script.
2. Is there a way to save the test logs for a test case? For example, if check for an element on the page and don't find it, how do I output that?


More From » node.js

 Answers
1

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);
});
}
);

[#71562] Sunday, April 6, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maureen

Total Points: 151
Total Questions: 110
Total Answers: 110

Location: Mali
Member since Fri, Dec 3, 2021
3 Years ago
;