Official Content

In this article, you will find examples of FileUpload command implementation in two different controls.

Automated file upload in File Upload User control

Web Panel with a FileUploadData variable called “FileUploadData”:

FileUploadData variable in webpanel

The variable view is the following:

viewFileUploadControl

To automated upload a file you have to use the commands FileUploadByName and  ClickBy, in example: 

//Start webdriver
&driver.Start()
&driver.Maximize()
// Initial navigation
&driver.Go(webpanelName.Link())
//automated files upload
&driver.FileUploadByName("files[]","path\PDFexample.pdf")
&driver.FileUploadByName("files[]","path\PDFexample2.pdf")
//...more files.. 
&driver.ClickByCSS("#FILEUPLOAD1Container > div > div.row.fileupload-buttonbar > div.col-lg-7 > button.btn.btn-primary.start > span")
&driver.End()

Notes:
* “files[]” is the name of “+Add files...” button
* The click command over is over the “Start upload” button to load the files

Automated file upload in Blob data type

Web Panel with a Blob variable called “AttacheBlob”:

FileUploadBlobVariable

The variable view is:

FileUploadBlobVariableView

To automated upload a file you have to use the command FileUploadByName. Optionally, you can verify the name upload file with the command Verify

//Start webdriver
&driver.Start()
&driver.Maximize()
// Initial navigation
&driver.Go(webpanelName.Link())
//automated file upload
&driver.FileUploadByName("vATTACHEBLOB","PDFUploadfile.pdf")
//verify the name of the upload file 
&driver.Verify((&driver.GetValueByName("vATTACHEBLOB").Contains("PDFUploadfile.pdf")))
&driver.End()


Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant