If you need to set up monitoring or load testing for web applications with file upload functionality, use EveryStep Scripting Tool Desktop to record the script.

The file upload recording is available for Chrome and mobile browsers only.

With the EveryStep Desktop, you can set up uploading of files up to 5MB and up to 20MB in total within a script. You can upload four files of 5 MB or 20 files of 1MB while recording a script.

How It Works

Dotcom-Monitor does not have a locally available storage. To emulate the upload process of a file, the system needs to download the file to the script from a public URL before executing the upload step. Thus, first, you need to provide a test file that will be used in the upload process to Dotcom-Monitor. To do this, put a test file up to 5 MB to a publicly accessible URL such as Amazon S3 bucket, Azure storage, or CDN services. Then, record the file upload step in the EveryStep Recorder. While recording the step you’ll be prompted to provide the link to the test file. As a result, Dotcom-Monitor will download the file from the provided URL to the system and use it in the upload process each time the script is executed.

Dotcom-Monitor executes all steps and actions in the script without delays by default. However, it typically takes some time to upload a file to a web resource. In this case, to simulate the delay and wait for the system to execute the upload step, it is recommended to add the Delay line to the script right after the upload step.

In addition, to make sure the upload was executed correctly, set up content validation after the upload step. In general, if dialog boxes or upload confirmations appear on the page after the file upload, add keyword validation or available code snippets to check if the upload step brought the expected results.

Recording the File Upload Script

Check the file upload setup steps below:

  1. In the EveryStep Desktop, record the file download. Use a file from a publicly accessible URL. If necessary, you can change the file name and link, as well as downloading timeout, by editing the related line in the Script Code area after recording.
  2. Record the script until the point you need to upload the file.
  3. Click the corresponding button on the target page to upload the file. In the dialog window, select the file that was downloaded earlier. The OpenFileDialogHandler line will be added to the script automatically.
  4. Add the Delay right after the upload step.
  5. Add the keyword or image validation to the script.
  6. If necessary, proceed with the recording; and stop the recording when ready.

Find the example of the file upload script recorded in the EveryStep scripting tool below.

// script_version=3.0; everystep_version=4.0.7508.283; date=8/26/2020; Chrome=77.0.3865.56
Tabs.SetSize (958, 538);
DMBrowser tab0 = null;
Step (1, "Tele2 Speedtest Service - http://speedtest.tele2.net/");
tab0 = Tabs.NewTab ();
tab0.GoTo ("http://speedtest.tele2.net/");
tab0.Link ("//A[normalize-space()=\"1MB\"]", "//A[normalize-space(text())=\"1MB\"]", "//A[normalize-space()=\"10MB\"]/preceding-sibling::A[1]").Click ();
//File Download
Step (2, "Tele2 Speedtest Service - http://speedtest.tele2.net/1MB.zip");
tab0.Downloading ("1MB.zip", "http://speedtest.tele2.net/1MB.zip");
tab0.Element ("//H1[normalize-space()=\"Tele2 Speedtest Service\"]/../..", "//SECTION[@ID=\"intro\"]", "//SECTION[@ID=\"http\"]/preceding-sibling::SECTION[1]").Click ();
//File Upload
Step (3, "Gofile - https://gofile.io/uploadFiles");
tab0.GoTo ("https://gofile.io/uploadFiles");
OpenFileDialogHandler (OpenFileDialogButton.Ok, new string[1] {"1MB.zip"});
tab0.Button ("//BUTTON[normalize-space()=\"Click here\"]", "//BUTTON[normalize-space(text())=\"Click here\"]", "//BUTTON[@ID=\"dropZoneBtnSelect\"]").Click ();
Delay ("40sec".ToDuration ());
//Keyword validation 
tab0.KeywordAssert ("size", "0msec".ToDuration ());