Categories

File selection by browsers

When performing business scenarios involving web solutions, there is a case that occurs frequently: the interactions with the operating system, and in particular the selection of files to download them to the web server ( we are talking about upload).

This feature is indeed implemented by all tools managing business data: ERP, GED, PLM, CRM...

The upload function is implemented natively in all browsers because they must respect the HTTP standard that specifies how this file transfer takes place.

All browsers have therefore implemented a file selection menu on the computer or on a network access, and then transmit it to the server. This usually involves using a modal file selection window whose implementation depends on the desktop environment, but each browser can have its own implementation.

Problems caused by tests automation

This causes two types of problems while automating this procedure in a test

  • Problem 1: The test software must be able to interface with the "desktop" part of the browser. In this case, to rely on the HTML page and the DOM is not enough, it is necessary either to recover and to recognize the internal structure of the components and controls of the navigators, or to use the graphic recognition.

  • Problem 2: The "file selection" can vary greatly from one browser to another, which requires adaptations depending on the browser used.

Solution to Problem 1

Agilitest is a multichannel solution

Agilitest is an integrated testing solution that supports the use of different application technologies (web, desktop...) within the same test.

Agilitest's capture tool enables toggling between DOM and Desktop.

  • Problem 1 is easily solved by Agilitest:

In your test execution, go to the download stage.

When the file selection window opens, open the capture tool.

To do this, click on the capture tool in the editor.

capture tool

Then press the "ALT" key on your keyboard or click on the corresponding button to switch from DOM component recognition mode to desktop component recognition mode.

system mode

Then, you will be able to navigate through your file selection window.

💡 Tip

For greater robustness, we advise you to place a file in an easily accessible tree structure of your file system that you can reproduce everywhere, for example in "quick access" under Windows Explorer.

Solution to Problem 2

Agilitest knows how to handle specific behavior of browsers

Problem 2 can be solved with data files (CSV) called as sub-scripts in Agilitest:

Sub-scripts established via a data file (CSV) must follow the following combination:

  1. Call a first sub-script fed by the "browser" parameter in the CSV file column.
  2. Retrieve the browser names to iterate the launch of the same test on several browsers.
  3. Call subsequent sub-scripts whose script name is composed from the "browser" parameter of the first sub-script.

Example:

Use the name of the browser to customize the name of the executed script: script_chrome.ats, script_firefox.ats, etc…

The proposed solution allows you to manage differences in browser behavior. However, we do not recommend using it for the following operations, which are handled directly by Agilitest for all browsers:

  • Navigating to a URL, to the previous page, to the next page, to the home page...
  • Close window
  • Switching tabs

This would render your tests non-generic, which is undesirable.


Still require support?
Contact support