TestProject Forum

Issue with file upload button

Hello testproject.io,

I am trying to upload a file from my local machine using the ‘Upload file’ addons. It seems like xpath = //input[@type = ‘file’] isn’t working for me. The upload button in our application doesn’t seem to have this xpath. Could you please help me with this?

Testproject step:

Error: Message

Unable to find an input element with type of ‘file’

Thanks,
Puja

1 Like

Hi @pujas,

Please try to hover over the input element → Press double shift → Choose upload file:

Then, paste the path to the file there and try again.

image

Thanks @dor.benzvi for the quick response.
I tried the steps mentioned by you. And am getting the following error:
Message

java.util.concurrent.ExecutionException: io.testproject.java.sdk.v2.exceptions.FailureException: Element must have the ‘type=file’ attribute!
Caused by io.testproject.java.sdk.v2.exceptions.FailureException: Element must have the ‘type=file’ attribute! at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)

Element

I

Searched by XPATH://i

My upload button does not have input type as file. I guess that might be causing the problem?

Thanks,
Puja

Hi @pujas,

Can you hover over the input element → Press double shift → Click on the parent element icon and upload the screenshot here:

@dor.benzvi ^^

@pujas Before opening this window.
Can you hover over the element that triggers this popup and try to add the action to it?

@dor.benzvi

@pujas
Can send me a message on the chat?
We can make a Zoom session to find a solution for that.

@dor.benzvi Pinged you here…is this the correct place to reach out to you? :smiley:

Thanks for your help @dor.benzvi . The issue is resolved now after the session we had. (We just had to search for the ‘input element’ using testproject’s explorer)

@door.benzvi Sorry, but I am having the exact same issue, and I do not seem to be successful picking neither the xpath to my ‘drop target’ nor the parent thereof.

Getting this ErrMsg thrown:

java.util.concurrent.ExecutionException: io.testproject.java.sdk.v2.exceptions.FailureException: Element must have the ‘type=file’ attribute!
Caused by io.testproject.java.sdk.v2.exceptions.FailureException: Element must have the ‘type=file’ attribute! at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)

Element

DIV2

Searched by XPATH://div[1]/div[1]/div[3]/div[2]/div/div/div[1]/div/div/div

Any advice, please? :slight_smile:

BR
Torben

Hi @tf1,

Have you tried using the element explorer to find the input element locator?
From the error message I can see that you are trying to upload a file, not to a type=file element.

Thx, Dor.

Well, it seems our devs have generated a ‘drop target’ instead and it works a bit differently, obviously.
I’ll investigate here – and possibly be back.

Are you saying or ‘drop target field’ should be a type=file element?

BR

Torben

@tf1 Sometimes the input element can be hidden under the drop field.
I suggest you use the element explorer to find the input element.

Thx, Dor

The dev chose deliberately to keep the element hidden, so the recorder wasn’t able to find the element.

Toggling :display ON shortly gave me the chance to grab both XPATH and CSSSELECTOR and it’s all working like a charm now :blush:

Thanks for your switch assistance,

BR
TORBEN