Ad

Selenium-ide, File Upload Not Working For React Application

Recording the test case using selenium ide for react application, but able to Upload a file from selenium-ide is not working. React-dropzone package is used for file upload.

Tried with command "type" and "send keys" but didn't work.

selenium-ide: 3.6.0 chrome: 74.0.3729.108

Tried with firefox but got an error message "File uploading is only supported in Chrome at this time"

Command: type
Target: css=input[type=file]
Value: c:\fakepath\test.png
Error: {"code":-32000,"message":"Not allowed"}


Command: send keys
Target: css=input[type=file]
Value: c:\fakepath\test.png
Error: Element is not currently interactable and may not be manipulatedElement is not currently interactable and may not be manipulated

selenium ide able to upload a file and pass the test case.

Ad

Answer

On Chrome you can go to: Window > More Tools > Extensions > Selenium IDE > Details

Then turn on the 'Allow access to file URLs' option.

I was having the same problem and this worked for me.

Ad
source: stackoverflow.com
Ad