Answer the question
In order to leave comments, you need to log in
How to upload files to website using selenium?
There was a problem with uploading files to the site through selenium. When selenium server and nodejs script are run locally everything works fine, when selenium server is run on a remote Ubuntu server it fails to upload files and no errors occur.
File upload code lines:
let absoluteFilePath = path.resolve(pathFileName);
const uploadElement = await this.client.findElement({ css: `input[name="${elementName}"]` }); // input type="file"
await uploadElement.sendKeys(absoluteFilePath);
The files are taken from the folder (relative to the nodejs project) /public/image/upload
I understand that you need to use setFileDetector or remote.FileDetector, but they do not help. Maybe I'm doing something wrong?
I use firefox
client.setFileDetector(new remote.FileDetector()); // didn't help
or
client.setFileDetector(wd.FileDetector.LocalFileDetector); // doesn't help either
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question