Menu Close

    How to Create Dropdown Attribute using Casperjs

    In Magento there are various “repetitive” tasks to check such as create the attributes with multiple input type like Dropdown etc. These repetitive actions take a lot of time when we have done manually but now it can be done in few minutes by automation.

    Here we’ll learn how we can select Dropdown option and fill the value of drop down option.

    Here we have used some CasperJs methods like-

    click() method is used to click a link and buttons.

    fill() method is used to fill the forms.

    Searching for an experienced
    Magento Company ?
    Read More

    echo() is used to print.

    wait() is used to wait for given amount of time.

    * Webkul Software.
    * @category Webkul
    * @package Webkul_CasperJS
    * @author Webkul
    * @copyright Copyright (c) 2010-2017 Webkul Software Private Limited (
    * @license
    var casper = require("casper").create({
    verbose: true,
    var i;
        this.fill('form#edit_form', {
           'frontend_input' : 'Country',  // 'name of the dropdown option' : 'Dropdown attribute title'
        }, false);
    // Add Dropdown options
    // Enter the value of Dropdown options
        this.fill('form#edit_form', {          // fill dropdown values
          'option[value][option_0][0]' : 'India',        // first value // Admin value
          'option[value][option_1][0]' : 'United State',  // second value // Admin value
          'option[value][option_2][0]' : 'China',        // third value // Admin value
    }, false);
    casper.then(function (){
       this.echo('Form submitted..!!', "PARAMETER");'#save');

    . . .
    Discuss on Helpdesk

    Leave a Comment

    Your email address will not be published. Required fields are marked*

    Be the first to comment.

    Back to Top