【问题标题】:Run/Execute CasperJS script by clicking a button on webpage通过单击网页上的按钮运行/执行 CasperJS 脚本
【发布时间】:2013-08-20 05:53:34
【问题描述】:

我有一个 casperJS 脚本,它在命令行上运行时返回一个 JSON。我想有这样的安排 1)我创建一个网页 2) 点击网页上的按钮后,casperJS 脚本会在服务器端执行并将结果发布/返回到网页。

我该怎么做。

编辑:我在单击按钮时调用用 php 编写的 AJAX 进程。 php脚本包含 echo exec('casperjs sample.js');
它只返回检查网络服务器错误日志,我收到错误
'casperjs' is not recognized as an internal or external command, operable program or batch file.

PS:它通过命令行运行得非常好。

EDIT2
我将 php 脚本更改为:
echo exec('C:\casperjs\batchbin\casperjs .\sample.js');
错误已修改为:
'phantonjs' is not recognized as an internal or external command, operable program or batch file.

【问题讨论】:

标签: php javascript api phantomjs casperjs


【解决方案1】:

我从我在 google 组的帖子中找到了解决方案

https://groups.google.com/forum/#!topic/casperjs/7Lps6TiX-78

它通过在目录服务器 (/html) 中移动 CasperJS 和 PhantomJS 可执行文件来工作

【讨论】:

    猜你喜欢
    • 2012-06-29
    • 1970-01-01
    • 2016-07-15
    • 2019-10-29
    • 1970-01-01
    • 2014-10-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多