J
J
JimmyTheWorm2018-03-24 18:35:22
Node.js
JimmyTheWorm, 2018-03-24 18:35:22

Where is the error in the casperJS code?

First time using Casper. I can't figure out what's wrong. There is a site. With the help of Casper I go to it, I try to press the login button, after pressing the module window should pop up. I wait 5 seconds (just in case). I'm taking a screenshot. There is no module window in the screenshot. Main page only. Where is the mistake?

var casper = require('casper').create({pageSettings: {
        userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.157 Safari/537.36'
}});
casper.options.viewportSize = {width: 1920, height: 1080};

casper.start("http://drakewing.com", function() {
   this.waitForSelector('.button.green.margin-top-50.font-size-30');
});

casper.then(function() {
   this.click('.button.green.margin-top-50.font-size-30',0);
});
casper.then(function() {
  this.wait(5000, function() {
        this.echo("I've waited for 5 seconds");
    });
});
casper.then(function() {
  console.log('captured');
    this.capture('google2.png');
});

casper.run();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question