3
casper.thenOpenを(使用しているとき、どのようにセッションを維持しますCasperJSで
:
var casper = require('casper').create();
casper.start('http://chaseonline.com/', function() {
this.echo(this.getTitle());
this.evaluate(function() {
document.getElementById("userid").value = "[email protected]";
document.getElementById("password").value = "asdf";
});
this.click("#btnSubmit");
});
casper.thenOpen('http://chaseonline.com/section/1/module/2/abc.jsp', function() {
// now this page never loads because the page requires a logged in session
// but casperjs doesn't appear to automatically propagate the session
this.echo(this.getTitle());
});
casper.run();
私は実際のURLとログインの詳細を提供できません。ここに詳細があります: –
明らかに、このthenOpen(url)では利用できないログインセッションのようです。 - ログインした後、私はスクリーンショットをキャプチャし、ログインが成功したことを確認します。 - thenOpen(url)をホームページ(認証が必要ない)やgoogle.comなどに変更すると、スクリプトが機能します。つまり、最後のURLのタイトルを表示します –
phantomjsまたはslimerjsを使用していますか?通常、セッションは実行中に格納されて格納されます(casper.run())。 – dasmelch