标签: spookyjs

错误 - 运行spookyjs

我在windows运行时遇到以下错误,spookyjs但代码正在运行linux.

错误

events.js:85
throw er; // Unhandled 'error' event
        ^
Error: spawn casperjs ENOENT
at exports._errnoException (util.js:746:11
at Process.ChildProcess._handle.onexit (ch
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
Run Code Online (Sandbox Code Playgroud)

注意:

我已经安装了所有依赖项并添加了PATHvaraiables

  1. Phantomjs
  2. 蟒蛇
  3. casperjs - 使用全局安装 npm install -g casperjs

在命令提示符casperjs下工作

我尝试过的:

  1. 安装npm作为全局使用

     npm install -g npm
    
    Run Code Online (Sandbox Code Playgroud)
  2. 卸载0.12并降级为0.10.

  3. 添加了System变量C:\Windows\System32;.

任何想法或建议都将不胜感激

windows node.js phantomjs casperjs spookyjs

11
推荐指数
1
解决办法
875
查看次数

如何在每次测试之间完美隔离和清除环境?

我正在尝试使用CasperJS连接到SoundCloud。有趣的是,一旦您登录并稍后重新运行登录功能,以前的登录仍处于活动状态。在继续之前,这里是代码:

casper.thenOpen('https://soundcloud.com/', function() {
  casper.click('.header__login');

  popup = /soundcloud\.com\/connect/;

  casper.waitForPopup(popup, function() {
    casper.withPopup(popup, function() {
      selectors = {
        '#username': username,
        '#password': password
      };

      casper.fillSelectors('form.log-in', selectors, false);

      casper.click('#authorize');
    });
  });
});
Run Code Online (Sandbox Code Playgroud)

如果您至少运行两次此代码,您应该看到以下错误出现:

CasperError: Cannot dispatch mousedown event on nonexistent selector: .header__login
Run Code Online (Sandbox Code Playgroud)

如果您分析日志,您将看到第二次,您将被重定向到https://soundcloud.com/stream,这意味着您已经登录。

我做了一些研究来清除每个测试之间的环境,但是似乎以下几行代码无法解决问题。

phantom.clearCookies()
casper.clear()
localStorage.clear()
sessionStorage.clear()
Run Code Online (Sandbox Code Playgroud)

从技术上讲,我真的很想了解这里发生的事情。也许SoundCloud构建了一个系统,还可以在服务器端存储一些变量。在这种情况下,我必须先注销才能登录。但是我的问题是,如何才能完美隔离并清除每个测试之间的所有内容?有人知道每次测试之间如何使环境无符号吗?

phantomjs casperjs spookyjs

5
推荐指数
1
解决办法
863
查看次数

SpookyJS示例/ hello.js失败,出现"throw er; //未处理'错误'事件"

当我从SpookyJS运行hello示例时,它失败并出现以下错误:

$ node examples/hello.js
events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
  at errnoException (child_process.js:998:11)
  at Process.ChildProcess._handle.onexit (child_process.js:789:34)
Run Code Online (Sandbox Code Playgroud)

实际上,我尝试的所有示例都会导致此错误.我陷入困境,因为即使在查看源代码时我也无法解释错误消息.你有什么想法?

(我正在使用Ubuntu和phantomjs 1.9.7)

node.js spookyjs

2
推荐指数
1
解决办法
1381
查看次数

标签 统计

spookyjs ×3

casperjs ×2

node.js ×2

phantomjs ×2

windows ×1