我正在尝试使用zombie.js对PHP 应用程序进行身份验证(尝试了2 个symfony2 应用程序和相同的结果)。但是浏览器会话在回调中是不一样的。我认为这就是身份验证失败的原因。
这是我的 node.js 代码
var Browser = require("zombie");
var assert = require("assert");
// Load the page from localhost
var browser = new Browser();
browser.site = "http://localhost:8000/";
browser.loadCSS = false;
browser.debug = true;
browser.visit("app.php")
.then(function(){
console.log(browser.cookies.dump());
browser.visit("app.php")
.then(function() {
console.log(browser.cookies.dump());
});
});
browser.visit("app.php")
.then(function(){
console.log(browser.cookies.dump());
});
并且在回调中使用不同的 phpssid 的结果
$ node test.js Zombie: Opened window http://localhost:8000/app.php
Zombie: Closed window http://localhost:8000/app.php
Zombie: Opened window http://localhost:8000/app.php
Zombie: GET http://localhost:8000/app.php => 200
Zombie: GET http://localhost:8000/app.php => 200
Zombie: Loaded document http://localhost:8000/app.php
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/
[ true ]
Zombie: Closed window http://localhost:8000/app.php
Zombie: Opened window http://localhost:8000/app.php
PHPSESSID=3qsqvtaseidgb5599803evt604; Domain=localhost; Path=/
[ true ]
Zombie: GET http://localhost:8000/app.php => 200
Zombie: Loaded document http://localhost:8000/app.php
Zombie: GET http://localhost:8000/app.php/js/0b50c2c.js => 200
PHPSESSID=jg9h8e2orbmbfq0dr65ni8ucs7; Domain=localhost; Path=/
[ true ]
Zombie: Event loop is empty
它是zombie.js 的错误吗?