"FILE_UPLOAD" Command

Description: This command is used with file upload widget (Defined by a locator with an XPath that has input tag with type = “file”) to upload a file included in the file field.
Usage Scenario: Supposed we want to upload an image as a logo to the first community that appears on our Reference app.

Procedure: Define a locator for the “Choose File” button using an XPath that directs to the input tag. The HTML tag for the input tag is

<input ng-show="ctrl.check() == 1" type="file" accept="image/*" file-model="avatar" class="">

and the XPath is

(//text()[contains(.,'Upload')]/ancestor::div/descendant::input)[1]

Once finished, upload a file to Subject7 and select it from File in your command options. Your step will look like this:

Web Locator:

image-20240206-125052.png
image-20240206-125112.png

 

Inline XPath:

 

See the Test Library path: subject7_samples/subject7_advanced_suite/subject7_add_community_image

The video following video demonstrates how the first community logo is uploaded as part of execution of “subject7_add_community_image” test case in “subject7_samples” folder: