AlertFox is part of the Ipswitch family of tools and services. Learn More »

Upload Files

The Upload Files functionality enables you to upload arbitrary files (with the exception of executable files such as .exe, .vbs, .bat, .cmd, etc.) to your AlertFox account for use with iMacros Image Recognition technology, for sensors that monitor/test uploading a file to your website, and as a data source for data-driven testing.

Upload

File Size

The maximum file size and space limit for uploads to an AlertFox account are:

• Single file: 1 MB
• Total upload space: 20 MB

If you need to upload a file bigger than 1 MB or to extend the upload space, you can contact our AlertFox support team.

Image Recognition

The use of Image Recognition is recommended if you need to test web sites with non-html based functions, such as Macromedia Flash (Shockwave) or Java applets. The computer vision commands for this are the IMAGESEARCH and IMAGECLICK commands. They do not rely on the coordinates of an element but only on its visual appearance. Thus buttons and input boxes can be found even if they move around on the screen.

Use Case 1: Testing Upload Functionality on a Web Page

To check the upload functionality of your website, upload the file (e.g. *.pdf) you want to use for the tests to your AlertFox account. Now you can create an iMacros sensor that uploads the same file to your web page. The following macro uses the iMacros upload demo page:

' Upload file to a web page
TAB T=1
TAB CLOSEALLOTHERS
URL GOTO=http://demo.imacros.net/Automate/FileUploadDemo
' Select a file for the upload
TAG POS=1 TYPE=INPUT:FILE FORM=ID:demo ATTR=NAME:uploaded_file CONTENT={{!FOLDER_DATASOURCE}}\Address.csv
' Display some information for the user
TAG POS=1 TYPE=TEXTAREA FORM=ID:demo ATTR=NAME:S1 CONTENT="Done! The filename is in the upload box."
WAIT SECONDS=1

Use Case 2: Using an uploaded file as a data source

If you have two or more iMacros sensors that use some of the same data, e.g. for filling out an online web form, rather than hard coding this data into each macro you can put it into a data source file (any text-only file such as .txt or .csv) and upload it your AlertFox account so that it can be shared by multiple sensors. This way when you need to make a change to the data, you only have to edit and re-upload the file instead of editing the macro code for each sensor.

The following example macro code shows how to reference the Address.csv file (included with iMacros) after it has been uploaded to your AlertFox account, and uses it on the iMacros Form Filling demo page:

' Uses a Windows script to submit several datasets to a website, e. g. for filling an online database
TAB T=1
TAB CLOSEALLOTHERS
' Specify input file (if !COL variables are used, IIM automatically assume a CSV format of the input file
' CSV = Comma Separated Values in each line of the file
SET !DATASOURCE Address.csv
SET !DATASOURCE_LINE 2
' Fill web form
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:fname CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:lname CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:address CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:city CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:zip CONTENT={{!COL5}}
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:state CONTENT=$*{{!COL6}}*
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:country CONTENT=$*{{!COL7}}*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:email CONTENT={{!COL8}}
TAG POS=1 TYPE=BUTTON:submit FORM=ID:demo ATTR=TXT:Submit

Another good use for a data source file is if you want to use randomized data in your sensor. For example, instead of always referencing the same row/record in the file, you can use the iMacros EVAL command to generate a random row number.

' Specify the first row number that contains actual data, e.g. 1 if the file does not have a heading row
SET FIRST_ROW 2
' Specify the last row/line number in the data source file
SET LAST_ROW 4
' Pick a random row
SET randomRow EVAL("var randomNumber = Math.floor(Math.random() * ({{LAST_ROW}} - {{FIRST_ROW}} + 1)) + {{FIRST_ROW}}; randomNumber;")
SET !DATASOURCE Address.csv
SET !DATASOURCE_LINE {{randomRow}}
' Fill web form
URL GOTO=http://demo.imacros.net/Automate/AutoDataEntry
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:fname CONTENT={{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:lname CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:address CONTENT={{!COL3}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:city CONTENT={{!COL4}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:zip CONTENT={{!COL5}}
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:state CONTENT=$*{{!COL6}}*
TAG POS=1 TYPE=SELECT FORM=ID:demo ATTR=NAME:country CONTENT=$*{{!COL7}}*
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:demo ATTR=NAME:email CONTENT={{!COL8}}
TAG POS=1 TYPE=BUTTON:submit FORM=ID:demo ATTR=TXT:Submit
TOP