Reputation: 2072
i want to upload a pic using robot framework into this :
I tried this :
Add PJ
Scroll Element Into View xpath://div[@class='drop-zone text-center']
Choose File xpath://label[@class='label-dropZone'] ..\Resources/Robot-framework-logo.png
but i'm getting this error :
ElementNotInteractableException: Message: element not interactable
Upvotes: 0
Views: 748
Reputation: 20077
What the underlying Selenium function behind Choose File
does is to enter the text you give to it (that's the path to the local file), in an <input>
element. These elements are the ones defined in the HTML standards for uploading files.
In "fancier" upload UI these input are hidden - the user doesn't see the file path, but sees explanatory text "choose a file here or drag&drop it", with pleasing formatting. This is the case with your example - and targeting that <label>
, Selenium has failed by saying it is not interactable - one cannot "type" on it; it does need an <input>
.
You may/should try to find the <input>
in the form, though hidden, and target it. Sometimes that is not possible though - there might be JS code preventing you to change it; so the success rate is varying.
Upvotes: 4