0
casperjs를 사용하여 페이지로드 시간을 캡처하려고합니다. 해당 페이지가 로그인으로 보호됩니다.casperjs를 사용하여 페이지로드 시간 얻기
var casper = require('casper').create();
// Enter the login page, fill up the form and submit it
casper.start('https://example.net/login', function() {
// Fill the form
this.fill('form[name=signin]', {
'user': 'username',
'passwd': 'password'
}, false);
// Submit the form by clicking the submit button
this.then(function() {
this.click('#sign_in');
});
});
// Now on the loggedin page click the link of page for which response time is needed
casper.then (function() {
var start = Date.now();
this.click ('#pageLink');
// Measure response time of this page
var end = Date.now();
this.echo (end - start);
});
casper.run();
내가 꽤 많이 나는 아마로드 페이지 기다린 후 종료 시간을 캡처해야하기 때문에 잘못된 접근법 알 수 있습니다 : 여기에 지금까지 가지고있는 것입니다. 그러나 캐스퍼 js 문서 페이지에서 페이지가 완전히로드되었을 때 알 수있는 것을 찾지 못했습니다. 닫는 태그를 찾고 그 태그가로드되었는지 확인하는 것이 맞습니까?
단일 페이지 응용 프로그램입니까? 그렇지 않다면, 다음의'casper.then' 블록에서'var end = Date.now();'를 캡처 할 수 있습니다. 왜냐하면 그것은 단계 함수이고 이전의 페이지가 완전히로드 된 실행 만 계속하기 때문입니다 단계. –