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.
echo() is used to print.
wait() is used to wait for given amount of time.
var casper = require("casper").create({ verbose: true, }); casper.then(function(){ this.fill('form#edit_form', { 'frontend_input' : 'Country', // 'name of the dropdown option' : 'Dropdown attribute title' }, false); }); casper.then(function(){ this.click('#add_new_option_button'); // click on add value button }); // fill the drop down option value casper.then(function(){ this.fill('form#edit_form', { // fill dropdown values 'option[value][option_0][0]' : 'India', // first value // Admin value 'option[value][option_0][1]' : 'India', // first value // Defualt store value 'option[value][option_1][0]' : 'United State', // second value // Admin value 'option[value][option_1][1]' : 'United State', // second value // Defualt store value 'option[value][option_2][0]' : 'China', // third value // Admin value 'option[value][option_2][1]' : 'China' // third value // Defualt store value }, false); }); casper.then(function (){ this.echo('Form submitted..!!', "PARAMETER"); this.click('#save'); }); casper.run();