Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9022041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:24:14+00:00 2026-06-16T05:24:14+00:00

I am trying to use CasperJS to automate some steps that usually require a

  • 0

I am trying to use CasperJS to automate some steps that usually require a lot of time to do. Basically I need to login to our CMS and check if some plugins are installed. If they are then just update them but if they’re not then create them. I managed to login and get to the page with the list of the plugins but I got into trouble here. Here’s what I need to do, in pseudocode:

for every plugin defined in my config file
    populate the search plugins form and submit it
    evaluate if the response contains my plugin

Here is the code

casper.thenOpen(snippetsUrl, function() {
    console.log(colorizer.colorize("###############PROCESSING SNIPPETS###################", 'ERROR'));
    this.capture('snippets.png');

    this.each(Config.snippets.station, function(self, snippet) {
        self.fill('form[id="changelist-search"]', {q: snippet.name}, true);
        self.then(function() {
            this.capture(snippet.name + '.png');
        })
    });
});

What happens is that my form gets submitted multiple times in a row and on my “then” step i end up capturing the same page multiple times…How to resolve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:24:16+00:00Added an answer on June 16, 2026 at 5:24 am

    Try this:

    this.each(Config.snippets.station, function(self, snippet)
    {
        self.then(function()
        {
            this.fill('form[id="changelist-search"]', {q: snippet.name}, true);
        });
        self.then(function()
        {
            this.capture(snippet.name + '.png');
        })
    });
    

    The reason why your initial code did not work is that Capser’s then declares a deferred execution step. If unwinded, your code did actually the following:

    submit form 1
    place capture 1 into a queue
    submit form 2
    place capture 2 into a queue
    submit form 3
    place capture 3 into a queue
    // then execute the queue
    capture 1
    capture 2
    caprure 3
    

    The resulting code has all steps placed into the queue, so they are executed in proper order.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use CasperJS to follow a link that's in an iframe but
I am need paint my image. I'm trying use JQuery in here this link:
I am trying use javascript regular expressions to do some matching and I found
Trying to use the RHEL5.3 GCC 4.3.2 compiler to build my software on that
I'm trying use eco for client-side templating. I have multiple .eco templates that I'd
I am trying use a from a multi-dimensional array that I create in another
I have a regex that I'm trying use to validate against strings. Trying to
I have a 3rd party DLL that I am trying to use in a
I am trying use Thread but i have some problem (I am beginner at
I am trying use the jQuery table sorter plugin for a table that is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.