Casperjs/Phantomjs 不尊重主机文件
Casperjs/Phantomjs does not respect hosts file
我正在尝试 运行 测试我的 vagrant box,生命周期为 192.168.0.100。在我的主机文件中,我有 192.168.0.100 lc.mysite.com 并且站点加载正常并且在 url 和 chrome.
下正常工作
但是,当我尝试 运行 对其进行测试时,url 失败并且从不加载任何内容。远程 urls 工作正常,但本地的只是失败。
如何让 casperjs 尊重我的主机文件?还是其他原因?
原来是因为 url 是 ssl 并且一直失败。使用这个答案解决了我的问题。
CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any
如果您使用的是自签名 SSL 证书(例如在您的开发盒上),请设置 phantomjs 选项
--ignore-ssl-errors=true
来自文档:
--ignore-ssl-errors Ignores SSL errors (expired/self-signed certificate errors): 'true' or 'false' (default)
我正在尝试 运行 测试我的 vagrant box,生命周期为 192.168.0.100。在我的主机文件中,我有 192.168.0.100 lc.mysite.com 并且站点加载正常并且在 url 和 chrome.
下正常工作但是,当我尝试 运行 对其进行测试时,url 失败并且从不加载任何内容。远程 urls 工作正常,但本地的只是失败。
如何让 casperjs 尊重我的主机文件?还是其他原因?
原来是因为 url 是 ssl 并且一直失败。使用这个答案解决了我的问题。
CasperJS/PhantomJS failing SSL handshakes on some sites even with --ssl-protocol=any
如果您使用的是自签名 SSL 证书(例如在您的开发盒上),请设置 phantomjs 选项
--ignore-ssl-errors=true
来自文档:
--ignore-ssl-errors Ignores SSL errors (expired/self-signed certificate errors): 'true' or 'false' (default)