, поэтому я вызываю первый URL-адрес ... он возвращает объект JSON, я сохраняю объект JSON в глобальной переменной с именем global_input
...., а затем открываю ссылку, используя global_input.token
var global_input = {'token' : 'xxx'} ;
casper.start('http://localhost/client/charg/que' , function (content) {
})
.then(function() {
global_input = JSON.parse(this.getPageContent());
casper.log( ' ==== token === > ' + global_input.token , 'debug');
})
.thenOpen('http://localhost/client/charg/go/' + global_input.token , function() {
})
.run(function(){
this.echo("DONE1");
this.exit();
});
вот лог
page init .....
[info] [phantom] Step anonymous 2/5 http://localhost/client/charg/que (HTTP 200)
[info] [phantom] Step anonymous 2/5: done in 725ms.
[info] [phantom] Step anonymous 3/5 http://localhost/client/charg/que (HTTP 200)
[debug] [phantom] ==== token === > e608e91335fd622f430692d40e7ddf0f4b63428d
[info] [phantom] Step anonymous 3/5: done in 750ms.
[debug] [phantom] opening url: http://localhost/client/charg/go/xxx, HTTP GET
, как вы можете видеть, хотя в журнале показано, что token
устанавливается на новое значение
==== token === > e608e91335fd622f430692d40e7ddf0f4b63428d
на следующем шаге я по-прежнему получаю значение токена по умолчанию, равное xxx
[debug] [phantom] opening url: http://localhost/client/charg/go/xxx, HTTP GET
я что-то упустил?