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

后端 未结 2 1651
遇见更好的自我
遇见更好的自我 2021-01-13 06:16

I have installed casperjs and phantomjs on my windows machina via npm. However I get this issue.

C:\\>casperjs sample.js

C:\\>Unable to open file: sam         


        
相关标签:
2条回答
  • 2021-01-13 06:59

    This is a known issue with CasperJS and the 1.9.8 version of PhantomJS. It doesn't do anything and the errors are only printed during exit. They don't interfere with your script. There is a workaround and it was merged into master branch on GitHub, but it is not available as a release of CasperJS yet (latest is 1.1-beta3).

    The easiest way to solve this is to downgrade to PhantomJS 1.9.7. Since you're using NPM it is easily done with

    npm -g install phantomjs@1.9.7-15
    

    The PhantomJS versions match with the NPM phantomjs package versions up until 1.9.7, then everything breaks. You can check the versions with npm show phantomjs.

    If you downgrade to version 1.9.7, you will have to run with the --ssl-protocol=any commandline option for sites that request https resources. The reason is shown in my answer here.

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

    References:
    GitHub issue #1068
    Workaround for CasperJS #1139
    PhantomJS issue on SO

    0 讨论(0)
  • 2021-01-13 07:00

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

    casperjs --ssl-protocol=tlsv1 test  run.js
    
    0 讨论(0)
提交回复
热议问题