https://frontier.com/login에 로그인하는 CasperJS 스크립트를 작성하려고합니다. 내가 액세스의 범위 (. 예를 들어 ng-model='login.loginId'
)에서 개최 된 값을 변경할 수 없습니다 보인다 그래서 AngularJS와 사용CasperJS를 사용하여 AngularJS 입력 필드를 양식 태그 밖으로 가져 오는 방법
: 때문에
나는 문제가 있습니다. 요소에 직접 값을 설정해도 아무런 효과가 없습니다.
입력 필드
는 폼 요소가 너무 CasperJS와 일반
casper.exists('input#fid-login-inline-username')
true를 반환 할 수 없습니다 사용하여 포장하지만,casper.sendKeys('input#fid-login-inline-username', 'blah')
말하는 오류를 제공하지 않는[error] [remote] mouseEvent(): Couldn't find any element matching 'input#fid-login-inline-username' selector
fillSelectors()
이
작업 할 필드는 다음과 같습니다.
input#fid-login-inline-password
- -
click()
에 대한 그래서, 어떻게 각도 범위에 캐스퍼에서 두 개의 입력 필드를 수정합니까? 여기
내가 무엇을 시도했다의 예입니다
casper.start('https://frontier.com/login', function() {
this.echo('waiting for password input field');
this.waitForSelector("input#fid-login-inline-password");
});
casper.then(function() {
if (this.exists('input#fid-login-inline-username')) {
this.echo('username input exists');
}
if (this.exists('input#fid-login-inline-password')) {
this.echo('password input exists');
}
this.echo('filling in username and password');
// these fields are not in a form element, so, use sendKeys to enter text...
// the above echoes print the fields exist, and then these sendKeys
// operations emit an error that the fields don't exist.
this.sendKeys('input#fid-login-inline-username', '[email protected]');
this.sendKeys('input#fid-login-inline-password', 'some-password');
});
casper.then(function() {
this.echo('clicking login button');
this.click('div.login-form-container button.btn-primary');
});