Reputation: 31
Here's the situation:
page
page
to go to page2
page2
to go to page3
Now I am on page 3 and I call this.back()
within a then statement and it does go back to page 2 and everything just stops executing after that
I also tried to call
this.then(function() {
this.evaluate(function() {
history.go(-1);
});
});
and it goes back to page2
and gets stuck again. The next line won't execute.
Any ideas or is this a bug?
Upvotes: 3
Views: 1298
Reputation: 28989
You can also access the existing PhantomJS WebPage instance via page
and call the goBack()
method:
casper.then(function () {
this.page.goBack();
});
Upvotes: 0
Reputation: 342
Typically, the following code works for me:
casper.then(function () {
this.back();
});
Make sure you are running on a step your code and finally, in a separate step, the step of returning the page. This is necessary so that your .back
be done AFTER your code.
Upvotes: 3