Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSCover with PhantomJS - TypeError: 'null' is not an object

When I try to run JSCover with PhantomJS, I see below ERROR:

Steps followed:

1) Run the JSCover Server:

java -jar ~/JSCover/target/dist/JSCover-all.jar -ws --report-dir=report

2) Run the PhantomJS runner with JSCover: *phantomjs --debug=true ~/JSCover/src/test/javascript/lib/PhantomJS/run-jscover-jasmine.js localhost8080/<app>/module/framework/test/SpecRunner.html

TypeError: 'null' is not an object(evaluating''document.body.querySelector('.description').innerText')`

phantomjs://webpage.evaluate():3 phantomjs://webpage.evaluate():22 phantomjs://webpage.evaluate():22 2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript result QVariant(, ) 2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript "(function() { return (function () { jscoverage_report('phantom'); })(); })()" 2013-09-19T16:36:07 [DEBUG] WebPage - evaluateJavaScript result QVariant(, ) 2013-09-19T16:36:07 [DEBUG] Network - Resource request error: 5 ( "Operation canceled" ) URL: localhost8080/<app_home>/lib/backbone/1.0.0/backbone.js?cb=0.5381254460662603

like image 864
Venkat Gajulapalli Avatar asked Sep 20 '13 00:09

Venkat Gajulapalli


1 Answers

This was an issue that I ran into yesterday. It turns out that the example script does not work for newer versions, so I built a new Phantom Script that works for Jasmine 2.X which fixes it. You can locate the working script here in my repository:

https://github.com/tkaplan/PhantomJS-Jasmine

like image 57
Dr.Knowitall Avatar answered Oct 06 '22 00:10

Dr.Knowitall