-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcasper.js
More file actions
32 lines (23 loc) · 697 Bytes
/
casper.js
File metadata and controls
32 lines (23 loc) · 697 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
'use strict';
/*global casper:true*/
var args = casper.cli.options;
var CF_QUERY = args.query;
var CF_HANDLE = args.handle;
var CF_PASSWORD = args.password;
if (CF_QUERY === 'undefined') {
throw new Error('No query defined.');
}
console.log(CF_QUERY, CF_HANDLE, CF_PASSWORD);
casper.start('http://codeforces.com/enter');
casper.then(function() {
this.echo(this.getTitle());
this.test.assertExists('#enterForm', 'HASU');
this.fill('#enterForm', {
'handle': CF_HANDLE,
'password': CF_PASSWORD
}, true);
});
casper.waitForSelector('#sidebar');
// Use complete=true to show all available contest
casper.thenOpen('http://codeforces.com/contests?complete=true');
casper.run();