Check this out, I have some code that attempts to click a link on a page as if I were doing it from the browser. However, when I try to do it through casper a banner login pops up and asks me for my login and password. I have a login and password for the site, but is there anyway I can get around (bypass) the login with casper or should I use an http module from nodejs?
phantom.casperPath = ('/Users/AustinJ/Desktop/streakscraper/node_modules/casperjs');
phantom.injectJs = (phantom.caperPath + '/Users/AustinJ/Desktop/streakscraper/node_modules/casperjs/bin/bootstrap.js');
var utils = require('smx-casper-utils');
var casper = require('casper').create();
casper.userAgent('Chrome/58.0.3029.81');
casper.start('http://streak.espn.com/en/').viewport(1200, 1000);
var x = require('casper').selectXPath;
casper.start('http://streak.espn.com/en/entry').viewport(1200, 1000);
casper.wait(3000, function() {
casper.capture('test1.jpg');
casper.click(x('//*[@id="games-content"]/div[2]/div[29]/table/tbody/tr[1]/td[8]'));
});
casper.wait(3000, function() {
casper.capture('test2.jpg');
});
casper.run();
Here is my code so far - it works how it's supposed to, but I don't know if it can do exactly what I need.
via tin10
No comments:
Post a Comment