zombie.js

Zombiejs jQuery nullTypeError 'compareDocumentPosition'

流过昼夜 提交于 2020-02-25 09:22:29
问题 Zombie: Cannot read property 'compareDocumentPosition' of null TypeError: Cannot read property 'compareDocumentPosition' of null This happens any time I try to load a page that includes jQuery using Zombiejs. This has happened to me on Debian & Windows, with a variety of different pages, using different versions of jQuery and with nothing else on the page. It seems to have something to do with the way jsDom evaluates jQuery before the page document is ready, but it's pretty far over my head.

Zombiejs jQuery nullTypeError 'compareDocumentPosition'

依然范特西╮ 提交于 2020-02-25 09:21:30
问题 Zombie: Cannot read property 'compareDocumentPosition' of null TypeError: Cannot read property 'compareDocumentPosition' of null This happens any time I try to load a page that includes jQuery using Zombiejs. This has happened to me on Debian & Windows, with a variety of different pages, using different versions of jQuery and with nothing else on the page. It seems to have something to do with the way jsDom evaluates jQuery before the page document is ready, but it's pretty far over my head.

Using jQuery in Zombie.js

[亡魂溺海] 提交于 2020-01-23 06:38:29
问题 I realize there are other libraries designed for the use of jQuery-like syntax with Zombie, but for my purposes, I specifically want/need to use jQuery itself in order to maintain compatibility with some earlier-written code. I installed the npm jQuery package, and I've been trying to import jQuery into my script and then initialize it with the window returned by Zombie like so: var Zombie= require("zombie"), $ = require("jquery") , zombie = new Zombie(); zombie.visit("http://www.mysite.com",

Prevent zombie.js from loading only external resources

喜欢而已 提交于 2020-01-22 22:56:08
问题 I am using zombie.js to load a page from a local express server during a test. Unfortunately, there is a script element which calls out to Google Analytics. I would like to block this external script (gracefully) without preventing other (local) scripts from loading, if possible. I know that { runScripts : false } is available with calls to browser.visit() . However, that refuses to load any and all scripts on the page, not just those living on other hosts. Is this possible? 回答1: You should

Why does the zombie.js browser return empty HTML when using Bootstrap?

感情迁移 提交于 2020-01-12 04:39:09
问题 I'm trying to test my Node.js/Express.js application using Mocha and Zombie. I can get simple tests to pass, but as soon as I add the script tags for Twitter Bootstrap to my views, the browser object returns empty HTML. Here is my test code: process.env.NODE_ENV = 'test'; var app = require('../app'); var assert = require('assert'); var Browser = require('zombie'); describe('home page', function() { before(function() { this.server = app.listen(3000); this.browser = new Browser({site: 'http:/

Zombie.js running slowly in VirtualBox shared folder

喜你入骨 提交于 2020-01-04 21:29:48
问题 I am trying to use Zombie in my Node.js project. The project runs in a shared folder on a VirtualBox VM. I am noticing a big drop in performance when Zombie is installed to the shared folder rather than globally. Suppose I have the following in zombie_test.js: require("zombie"); If I install zombie globally, the require statement runs in less than a second: $ sudo npm install zombie -g ... $ time node zombie_test.js real 0m0.651s user 0m0.464s sys 0m0.116s If I install the package locally,

Node.js - why do I get leaks when testing with mocha and zombie?

£可爱£侵袭症+ 提交于 2020-01-03 15:31:10
问题 I've tried to make zombie work with mocha, but unless I use the mocha --ignore-leaks command options, my test always fails with the error: Error: global leaks detected: k, i, name, chars, char My test looks exactly like the one explained in this thread: Mocha and ZombieJS I wish I could have posted my question there, but as a newbie, I cannot comment on the thread, only ask a new question. Do you have any idea why I get these leaks? I'm using mocha 1.0.3 and zombie 1.0.0. 回答1: The leaks can

Windows 8 : `node-gyp rebuild` Exit status 1 installing contextify as dependency of zombie

穿精又带淫゛_ 提交于 2020-01-02 08:11:38
问题 I'm trying to install zombie js, and get this error: > contextify@0.1.8 install C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\zombie\node_modules\jsdom\node_modules\contextify > node-gyp rebuild Das System kann den angegebenen Pfad nicht finden. C:\Users\User\Documents\ArbeitPhilipp\clieman\billing\node_modules\zombie\node_modules\jsdom\node_modules\contextify>node "C:\Program Files (x86)\nodejs\nod e_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp

Express.js and Zombie.js - Can't seem to parse Javascript assets

若如初见. 提交于 2019-12-25 05:23:43
问题 I have an Express.js app that uses connect-asssets to serve JS and CSS: app.configure(function() { app.set('port', 3000); app.set('views', path.join(__dirname, 'views')); app.set('view engine', 'ejs'); app.use(connectAssets({src: path.join(__dirname, 'assets')})); }); I'm trying to use Zombie.js for acceptance testing, but keep getting SyntaxError: Unexpected token ILLEGAL whenever it tries to parse a Javascript file. If I replace connect-assets with express.static , then the acceptance tests

Checking JavaScript AJAX loaded resources with Mink/Zombie in PHP?

守給你的承諾、 提交于 2019-12-23 03:01:54
问题 I'm trying to test a page, which otherwise uses massive asynchronously loaded JavaScript resources, with PHP script that uses Mink and Zombie. Unfortunately, this process fails (leaving behind hanging processes). I have managed finally to simulate this error on a minimal example, which I'll post here. The first page - the page to be tested - is basically a self-contained file, that simulates the AJAX calls by calling itself: test_JSload.php <?php if (array_key_exists("QUERY_STRING", $_SERVER)