Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var username = "my_username", password = "my_password";
- var address = "http://my_url_address.com", sources = [];
- var casper = require('casper').create({
- waitTimeout: 30000,
- viewportSize: {
- width: 1024,
- height: 768
- },
- clientScripts: [
- 'jquery.min.js',
- 'jquery.cookie.js'
- ],
- pageSettings: {
- loadImages: false,
- verbose: true,
- logLevel: 'debug'
- }
- });
- casper.on("resource.received", function(resource) {
- console.log(resource.contentType);
- if (resource.contentType == 'my_content_type') {
- sources.push(resource.url);
- }
- });
- casper.start(address, function() {
- this.waitForSelector('#login', function() {
- this.click('#login');
- });
- });
- casper.then(function() {
- this.evaluate(function(username, password) {
- document.querySelector('#username').value = username;
- document.querySelector('#password').value = password;
- document.querySelector('#loginSend').click();
- }, username, password);
- this.wait(4000, function() {
- this.open(address + "/resource_path_of_the_video");
- });
- });
- casper.then(function() {
- this.wait(30000, function() {
- });
- casper.run(function() {
- this.echo("finish");
- this.exit();
- });
- this.wait(4000, function() {
- this.open(address + "/resource_path_of_the_video");
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement