Element not interactable - attempting to upload file from windows explorer

Hello All,

I am attempting to upload a file from windows explorer when running a test, however, I receive and element not interactable error.

For context, the desired flow of the test would be:

Click upload button in web browser → windows explorer opens → select file → press button to upload

I have attempted setting a delay to ensure the object has loaded, but the error still persists.

1 Like

which type of error reported?

The exact error given is: org.openqa.selenium.ElementNotInteractableException: element not interactable

1 Like

I think your next desired element is not available within time limit, So you just put code of wait before which line is showing Error.
WebUI.waitForElementVisible(findTestObject(‘your object repository’), 20)
WebUI.waitForElementPresent(findTestObject(‘your object repository’), 10)

Thank you for the suggestion, I have tried this and it still seems to time out. I am attempting to use sendKeys now with the input element itself to see if I can get that method to work

Can you share Error log or screenshot?

Without knowing more, just from your desired flow:

Click upload button in web browser → windows explorer opens → select file → press button to upload

The “select file” step is not possible to automate, as the file explorer is a windows process, not managed by your browser.

The usual way to do this is to use the uploadFile keyword:

WebUI.uploadFile(findTestObject('Upload File'), '/path/to/file')

where the 'Upload File" test object points to the upload field, and the ‘/path/to/file’ is the absolute path to the file on your system.

Then you’d click the upload button.

If this doesn’t clarify, could you provide the following?:
1.) A screenshot of the field/button you are working with in the UI.
2.) A screenshot of the HTML for those widgets.
3.) The code you are currently trying to run to get this working.

Thanks

3 Likes

Thank you, this solved my issue. I had attempted using uploadFile before but hadn’t realized how the mapping worked until reading your comment!

1 Like

Glad you got it working!

1 Like