The problem is next: I have JavaScript code in my application and I want to skip/hide some peace of code from PhantomJS and grover checking/execution.
So, how can I skip/hide the code execution from PhantomJS or grover?
Note: the problem has occurred when I was writing the JavaScript unit-tests.
But I think it would be helpful in other cases.
You just need to wrap the code with simple verification:
if (!window['phantom'] && !window['_phantom']) {
// your code here...
}
In this case the code in your application will be executed as normal but skipped when the PhantomJS or grover will inspect it.
Notes:
- I use "window['phantom']" - because my application is minimized using google closure
compiler, in other case you can easily use (!window.phantom &&
!window._phantom);
- window['_phantom'] - indicates presence PhantomJS using grover tool.