https://www.facebook.com/plugins/like.php issue!!

93 views
Skip to first unread message

bruce

unread,
Jun 7, 2016, 3:10:56 PM6/7/16
to casp...@googlegroups.com
The attached script can be run, currently using centos 6.5 with older versions of casperjs/phantomjs.

I'm curious, can someone run the test script, and let me know it it returns a valid page.. The site/page is the midlandstech.bncollege.com page for textbooks for the college..


usage:
casperjs bn_term4_campus.js  --ignore-ssl-errors=true --ssl-protocol=any   --url1="http://midlandstech.bncollege.com/webapp/wcs/stores/servlet/BNCBHomePage?catalogId=10001&langId=-1&storeId=87747"   --campusVal="65582847"


test script:
==============================================
/*
*
*    bn_term4_campus.js:        test to generate the term page for the bn input using the campus
*
*    casper.js bn_term3_campus.js  --url1="foo"  --url2="foo1"
*
*
*/
var casper = require('casper').create({
    verbose: true,
    logLevel: "debug",
    waitTimeout: 100000, // new maximum waitTimeout   
    pageSettings:
        {
            userAgent:    'Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Firefox/24.0'
        }
});

phantom.timeout=100000;
phantom.stepTimeout=100000;

var x = require('casper').selectXPath;
phantom.cookiesEnabled = true;


var url1 = casper.cli.get("url1");
var campusVal = casper.cli.get("campusVal");


casper.onResourceRequested = function(requestData, request) {
    if ((/http:\/\/.+?\.css/gi).test(requestData['url']) || requestData.headers['Content-Type'] == 'text/css') {
        console.log('The url of the request is matching. Aborting: ' + requestData['url']);
        request.abort();
    }
};


casper.start().then(function() {
  this.open(url1, {
    method : 'get',
    headers : {
        'User-Agent'    : 'Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Firefox/38.0'
    }
  });
});



casper.waitForSelector(x('//a[contains(@title,"Find Textbooks")]'), function() {
    //this.echo("here 111...........");
    this.click('a[title="Find Textbooks"]');
});




casper.waitForSelector(x('//li[@data-optionvalue="'+campusVal+'"]'), function() {
    //this.echo("here...........");
    //this.click(x('//li[@data-optionvalue="'+campusVal+'"]'));
    this.click('li[data-optionvalue="'+campusVal+'"]');
});


//--should only fire after the campusVal sel..
casper.waitForSelector(x('//li[contains(@class,"termOption")]'), function() {
    //this.echo("term... ");
    this.echo(this.page.content).exit();
});


casper.run(function () {
    // echo results in some pretty fashion
//    this.echo(this.debugPage()).exit();
//    fs.write(cookie_file, JSON.stringify(phantom.cookies), 644);
//    this.echo("finish").exit();
//    this.echo(this.page.content).exit();
});

======================================================
Reply all
Reply to author
Forward
0 new messages