I am facing an issue with my page code. The code contains a list of items and I need to extract the values of Test, Application, Success, Error from these items. However, when I try to write this data to a file, it returns [object, Object]. Can someone please assist me in solving this problem?
<div _ngcontent-c5="" class="grid-container">
<div _ngcontent-c5="" class="grid-x">
<div _ngcontent-c5="" class="small-12 medium-12 large-6 cell">Test:</div>
<div _ngcontent-c5="" class="small-12 medium-12 large-6 cell">
<!--bindings={
"ng-reflect-ng-if": "true"
}--><span _ngcontent-c5="" class="success">It works</span>
<!--bindings={
"ng-reflect-ng-if": "false"
}-->
<!--bindings={
"ng-reflect-ng-if": "false"
}-->
</div>
</div>
<div _ngcontent-c5="" class="grid-x">
<div _ngcontent-c5="" class="small-12 medium-12 large-6 cell">Application:</div>
<div _ngcontent-c5="" class="small-12 medium-12 large-6 cell">
<!--bindings={
"ng-reflect-ng-if": "false"
}-->
<!--bindings={
"ng-reflect-ng-if": "false"
}-->
<!--bindings={
"ng-reflect-ng-if": "true"
}--><span _ngcontent-c5="" class="error">Error</span>
</div>
</div>
This is how I am attempting to retrieve the data:
it('save to file', () => {
var fs = require('fs');
var area = element.all(by.css('.div.grid-container'));
var outputFileName = 'Output.json';
fs.writeFile(outputFileName, area, function(err){
if(err){
console.log(err);
}
else{
console.log("JSON saved to " + outputFileName);
}
});
});