Need to input file into file input field using LeanFT

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: 328, Answers: 10)
Asked on July 30, 2019 8:45 pm
17 views
Answers
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: 16, Answers: 738)
Answered on July 30, 2019 8:46 pm
Thanks, the .setValue did the trick!
( at July 30, 2019 8:47 pm)