运行 phantomjs/casperjs 使用 Python 启动的脚本中的本机选项
Running phantomjs/casperjs native option in script that is launched with Python
CasperJS 版本 1.1.0-beta3,在 OSX 10.10.4 64 位上使用 phantomjs 版本 1.9.8 和 Python 2.7.6。
您好,感谢您的光临:)
我正在 运行使用 casperjs 编写一个 JS 脚本,它需要使用 Python 脚本启动。
从 bash 启动时,JS 脚本需要 CLI --ignore-ssl-errors=true
才能成功 运行。
在 bash 中启动 Python 脚本时,无法使用 --ignore-ssl-errors=true
,因为它是 phantomjs/casperjs 本机选项。为了解决这个问题,我尝试以编程方式进行,因为根据 this question.
的评论,这似乎是可能的
阅读 this 后,我在我的 JS 脚本中使用了以下语法组合:
ignoreSslErrors : true;
ignoreSslErrors = true;
ignoreSslErrorsEnabled : true;
ignoreSslErrorsEnabled = true;
None 在启动 JS 脚本时起作用,因此在脚本运行时不起作用
使用 Python 脚本启动。我是不是漏掉了什么语法?
有没有办法通过 Python 脚本向 phantomjs/casperjs 发送本机命令?具体来说,有没有办法通过Python脚本发送--ignore-ssl-errors=true
?
如果您需要更多详细信息,请告诉我。
感谢您抽出时间阅读:)
> 在 bash 中启动 Python 脚本时,无法使用 --ignore-ssl-errors=true
其实很有可能。这种方式很好用:
import subprocess
args = ['/usr/local/bin/casperjs', '--ignore-ssl-errors=true', '/path/to/script.js']
subprocess.call(args)
CasperJS 版本 1.1.0-beta3,在 OSX 10.10.4 64 位上使用 phantomjs 版本 1.9.8 和 Python 2.7.6。
您好,感谢您的光临:)
我正在 运行使用 casperjs 编写一个 JS 脚本,它需要使用 Python 脚本启动。
从 bash 启动时,JS 脚本需要 CLI --ignore-ssl-errors=true
才能成功 运行。
在 bash 中启动 Python 脚本时,无法使用 --ignore-ssl-errors=true
,因为它是 phantomjs/casperjs 本机选项。为了解决这个问题,我尝试以编程方式进行,因为根据 this question.
阅读 this 后,我在我的 JS 脚本中使用了以下语法组合:
ignoreSslErrors : true;
ignoreSslErrors = true;
ignoreSslErrorsEnabled : true;
ignoreSslErrorsEnabled = true;
None 在启动 JS 脚本时起作用,因此在脚本运行时不起作用 使用 Python 脚本启动。我是不是漏掉了什么语法?
有没有办法通过 Python 脚本向 phantomjs/casperjs 发送本机命令?具体来说,有没有办法通过Python脚本发送--ignore-ssl-errors=true
?
如果您需要更多详细信息,请告诉我。
感谢您抽出时间阅读:)
> 在 bash 中启动 Python 脚本时,无法使用 --ignore-ssl-errors=true
其实很有可能。这种方式很好用:
import subprocess
args = ['/usr/local/bin/casperjs', '--ignore-ssl-errors=true', '/path/to/script.js']
subprocess.call(args)