2014-12-01 2 views
1
url = "https://example.com/"; 
casper.start(url, function() { 
    this.echo('url: ' + url); 

    this.echo('myCloud requested...'); 
    this.echo('Page title: ' + this.getTitle()); 


}); 
casper.then(function() { 
    this.echo('Clicking submit button...'); 

    this.click('input#SubmitButton'); 
... 

나는 "ADFSloginUrl"ADFS 로그인 페이지로 리디렉션 일반 브라우저에서 portalUrl을 ("https://example.com/") 요청하지만, 사용 CasperJS은 로그인 페이지에 액세스 할 수없는 경우 ADFS의CasperJS '시작이 작동하지 않습니다

위 코드에서 요청한 페이지가로드되지 않았습니다.. 'this.getTitle()'이 비어 있고 은 CasperJS의 제출 버튼에 액세스 할 수 없습니다. 제출 '버튼을 액세스 할 때

은 다음과 부여합니다 오류 :

"Message: CasperError: Cannot dispatch mousedown event on nonexistent selector: input#SubmitButton"

이이 casper.start와 아무 상관이 있나요?

+1

에서 ['resource.error']에 등록하십시오 정말 도움이되었다 (http://docs.casperjs.org /en/latest/events-filters.html#resource-error), ['casper.page.onResourceTimeout'] (http://phantomjs.org/api/webpage/handler/on-resource-timeout.html), [ 'remote.message'] (http://docs.casperjs.org/en/latest/events-filters.html#remote-message) 및 ['page.error'] (http://docs.casperjs.org/ en/latest/events-filters.html # page-error) 이벤트가 발생했습니다. 어쩌면 오류가있을 수 있습니다. –

+0

또한 어떤 버전의 PhantomJS 및 CasperJS를 사용하고 있습니까? –

답변

0

어떻게 waitFor 사용에 대한이 오히려 HTTP보다가 리디렉션 자바 스크립트에서 무슨 일이 일어나고 있음을 나타낼 수 있습니다 작동 않는 경우, 수준을

url = "https://example.com/"; 
casper.start(url, function() { 
    this.echo('url: ' + url); 
}); 

casper.waitFor('input#SubmitButton', function() { 
    this.echo('Page title: ' + this.getTitle()); 
    this.echo('Clicking submit button...'); 
    this.click('input#SubmitButton'); 
    }, function onTimeout(){ 
    this.echo("The submit button did not appear within 15 seconds..."); 
    }, 15000); //15 second timeout 

합니다. (그렇지 않으면 미묘한 타이밍 버그 코드에 크리프 수있는 그것은, 어쨌든 좋은 방법입니다.) 또는


, 행동이 PhantomJS와 SlimerJS 사이에 약간의 차이가 있음을 지적 this bug report를보십시오.

1

--ssl-protocol = any가 나를 위해이 문제를 해결했습니다. casperjs --ssl 프로토콜 = 모든 yourcode.js 모든 답변을

감사하고 그들이

관련 문제