Skip to main content

Advanced Web File Upload

Description

Use the step to upload a local file to a web page by locating the target upload element. The step supports all file types and uploads the specified file to the target location during execution, and removes the need to use custom Java code for file uploads.

Note
  • The step supports only file input elements (<input type="file">).
  • If the located element is a different type, the step fails with the following error: Element found with {criteria}: {value} is not a file input element. The element must be <input type="file">.
Important

The file path cannot be blank, and the specified file must exist on the local disk. If the file does not exist, the step fails with the following error: File Path does not exist: {path}

Configurations

Field NameDescription
Step nameSpecify a unique name for the step.
The label identifies the step within the workflow and helps you reference it when debugging or linking steps.
Web browser nameSelect the web browser or driver instance to act on. Ensure browser matches the browser specified in the Start Browser step.
The field is mandatory.
CriteriaSelect the locator strategy to find the target upload element on the web page.
For list and description see Criteria Table.
The field supports variable or static values, and the field is mandatory.
Criteria valueSelect or specify relevant value for the selected criteria.
The field accepts variable or static values or previous step field, and the field is mandatory.
Multiple elements with same criteriaSelect the checkbox to handle the scenario where the locator matches more than one element on the page.
Element index (Starts with 0)Specify the index number of the element to use when the criteria match multiple elements. The index starts at 0.
Default value: 0
File PathSpecify the local path of the file to upload. The step resolves the absolute path and sends it to the file input element.
The field accepts variable or static values or previous step field
Or
Click Browse to locate the file manually.

Criteria

The following table contains the description of criteria:

FieldDescription
XpathXpath defines the hierarchy of the tags through which you can reach to a particular element.
For example, /html/body/div[1]/div/div[3]/div[2]/div/div[2]/div/div/div[2]/div[2]/div[1]/div[1]/div[1]/span/span
IdId attribute of a web element can be best way to identify an element if it is present and is going to constant and unique. There are cases however when it is either absent or its value changes every time you access the application in the browser.
NameName is another attribute of a web element which can be used to identify an element.
Link TextIf a HTML page contains a hyperlink element <a href=www.google.com>Search On Google</a>, you can identify this href element by providing complete text ‘Search On Google’ as the Link value.
Partial Link textThe criteria is same as Link, just that, in this case, you can give partial string for finding a match.
Tag NameEvery HTML element has a tag associated with it. The element can be located using that tag name. For example, textbox has a tag <input>.
Class NameClass name is the css class associated with an HTML element. If there is a div element <div class=’someclass’>MyDiv</div>, you can locate it by giving class name ‘someclass’.
Css SelectorThis criterion is useful when an HTML element has multiple associated css classes. Consider an HTML element <div class="btn primary-btn submit"></div>. To identify this div element you can use Css selector as “.btn.primary-btn.submit”