Unsafe javascript trying to access frame when installing casperjs through npm windows

I installed casperjs and phantomjs on my machina windows via npm. However, I get this problem.

C:\>casperjs sample.js C:\>Unable to open file: sample.js Unsafe JavaScript attempt to access frame with URL about:blank from frame with URL file:///C:/Users/vini/AppData/Roaming/npm/node_modules/casperjs/bin/bootstrap.js. Domains, protocols and ports must match. 
+5
source share
2 answers

This is a known issue with CasperJS and PhantomJS version 1.9.8. It does nothing, and errors are only output during exit. They do not interfere with your script. There is a workaround, and it has been merged into a lead branch on GitHub, but it is not available as CasperJS release yet (latest version 1.1-beta3).

The easiest way to solve this is to upgrade to PhantomJS 1.9.7. Since you are using NPM, this is easy to do with

 npm -g install phantomjs@1.9.7-15 

PhantomJS versions correspond to phantomjs NPM versions up to 1.9.7, then everything breaks. You can check versions with npm show phantomjs .

If you upgrade to version 1.9.7, you will have to run with the command line --ssl-protocol=any for sites requesting https resources. The reason is given in my answer here.

the correct way to solve this problem is to install a new version from git . This will allow you to not only use PhantomJS 1.9.8 without additional error lines, but also PhantomJS 2, which would not be possible with CasperJS 1.1-beta3.

Literature:
GitHub Problem # 1068
Workaround for CasperJS # 1139
Problem with PhantomJS on SO

+10
source

Using " phantomjs": "^1.9.9" And for caseperJs

 casperjs --ssl-protocol=tlsv1 test run.js 
0
source

Source: https://habr.com/ru/post/1216386/


All Articles