Automation Testing (Data Fill) via Excel using iMacros

By | November 26, 2014

In this article we will learn to fill the web form using Automation with just few line of code. No technical skill required nor automation certification to perform this automation testing.

To demonstrate this automation first we  need to install the iMacros Adons either in Mozilla, Chrome, IE.

Once the iMacros installed on your browser click on iMacros icon  iMacros

 

iMacRecord  Now click on Record Button, it will ask for close all the tabs click ok and proceed.

Now open the url on which you want to perform the automation.

To demonstrate the automation data entry i have created the simple web form in google drive which is accessible via link Google Form

If you unable to open link then copy and paste the url on your browser https://docs.google.com/forms/d/1wTsmRercozMnzJ9TjkQPAn1tHJutw5VP778j7cyrksc/viewform

Now fill the form and click on submit button, your response will get submitted successfully. Now click on stop button and save the script.

Now we need to create to csv file to import the bulk record on just one click.

Create Excel file and rename it what you want and save it as “filename.csv”.

Sample CSV File

sampledata

Now open the script generated by the iMacros by clicking on Manage Tab and open the script

Original Code will be link this

VERSION BUILD=8871104 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
'Fill the Form
URL GOTO=https://docs.google.com/forms/d/1wTsmRercozMnzJ9TjkQPAn1tHJutw5VP778j7cyrksc/viewform
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_25909682 CONTENT=Vibhuti
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_236860026 CONTENT=singhvibhuti@gmail.com
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_2134757264 CONTENT=mypassword
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1123387841 CONTENT=mypassword
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_2080955037 CONTENT=7/7/1988
TAG POS=1 TYPE=SELECT FORM=ID:ss-form ATTR=ID:entry_958501620 CONTENT=%Male
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_934618189 CONTENT=Mumbai
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_984016663 CONTENT=Maharashtra
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:ss-form ATTR=ID:ss-submit

TAB T=1

 

Now we will add few lines of code to get the data from csv and submit the same to web form created on google drive.

 

  1. Add line SET !DATASOURCE d:\GoogleDoc.csv after “TAB CLOSEALLOTHERS
  2. Set the row number where you want to start
  3. SET !LOOP 2
  4. Set the line to run in loop
  5. SET !DATASOURCE_LINE {{!LOOP}}
  6. Now replace the actual value with the {{!COL1}}, {{!COL2}} followed by format you have define in csv file
  7. Click on Save & Close
VERSION BUILD=8871104 RECORDER=FX
TAB T=1
TAB CLOSEALLOTHERS
SET !DATASOURCE d:\GooleDoc.csv
'Start at line 2 to skip the header in the file
SET !LOOP 2
'Increase the current position in the file with each loop 
SET !DATASOURCE_LINE {{!LOOP}}
'Fill the Form
URL GOTO=https://docs.google.com/forms/d/1wTsmRercozMnzJ9TjkQPAn1tHJutw5VP778j7cyrksc/viewform
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_25909682 CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_236860026 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_2134757264 CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_1123387841 CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_2080955037 CONTENT={{!COL5}}
TAG POS=1 TYPE=SELECT FORM=ID:ss-form ATTR=ID:entry_958501620 CONTENT=%{{!COL6}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_934618189 CONTENT={{!COL7}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:ss-form ATTR=ID:entry_984016663 CONTENT={{!COL8}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:ss-form ATTR=ID:ss-submit

TAB T=1

Now need to click on button Play(Loop) before that Max: row value the no of row you want to send to web form. I given example i have created 12 records so i set the Max: value to 12. and click on Play(Loop) button.

All 12 records get successfully on site

Play

Note: Automation testing will work only on static page, if your page form is changed on selection of buttons then you can created multiple script to run the automation on various scenario.

Hopes you will enjoy this automation tool 🙂

If you faced any issues while performing automation test you can share your experience with us via commenting the same  on the article.

Your valuable feedback will help the others.

1,202 total views, 1 views today