Need to input file into file input field using LeanFT
Category:
Question ID: 109145
1
0

Our AUT a file upload field, here’s the code description of it:

browser.describe(FileField.class, new FileFieldDescription.Builder()
.tagName("INPUT")
.name("WebFile").build());

How do I send files to this field?

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on July 30, 2019 8:45 pm
245 views
Answers (1)
1
Private answer

The below code should work, using the .setValue method:

Browser browser = BrowserFactory.launch(BrowserType.CHROME);
browser.navigate(''http://yourURL.come/FileInputPage.html'');

FileField datafileFileField = browser.describe(FileField.class, new FileFieldDescription.Builder()
.index(0)
.name(''datafile'')
.tagName(''INPUT'').build());

datafileFileField.setValue(''c:\myfile.txt'');

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on July 30, 2019 8:46 pm
0
Thanks, the .setValue did the trick!
( at July 30, 2019 8:47 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top