Windows Browse Window Doesn't Close when Uploading a File

I completed a test case that uploads a file using the WebUI.upload file. On my machine, everything works perfectly. On other user’s machines the Window’s browse window opens and will not close. I’ve pushed my changes to our git repository, made sure they checked out the current branch, but they are still experiencing the problem. I can’t duplicate it. Here’s my code:‘Project Name/Project Form/div_Uploads’))
TestObject chooseUploadFileButton = findTestObject(‘Project Name/Project Form/input_asset’)
String projectDir = RunConfiguration.getProjectDir()
String uploadPath = projectDir + “/Upload Files/Upload_Test.xlsx”
String formattedUploadPath = uploadPath.replace(“/”, “\”)

WebUI.waitForElementPresent(findTestObject(‘Project Name/Project Form/input_File uploads are disabled’), GlobalVariable.timeout)
WebUI.waitForElementClickable(findTestObject(‘Project Name/Project Form/input_File uploads are disabled’), GlobalVariable.timeout)‘Project Name/Project Form/input_File uploads are disabled’))

WebUI.uploadFile(chooseUploadFileButton, formattedUploadPath)‘Project Name/Project Form/button_Upload File’))

It seems like it’s clicking on the button that causes the browse button to open twice. Help please!

This should upload the file:

This, if it is the same upload button with type="file", will click the button (in effect, again)

So first try removing the line above.

They are different objects. In my test you first have to click on an acceptance box (input_File uploads are disabled), then click to upload a file, which should open a browse window (input_asset), then click on another button to actually upload the file (button_Upload File). I’ve checked the properties of the objects in question, but they don’t have any common attributes between them, other than being in the same location on the page. It’s driving me nuts that it works on mine just fine and no one else can get it to run properly.

I appreciate your help very much! If there is anything else you can think of, I’d be grateful!

Wow. What a painful experience you’re having.

Okay, just so we’re clear, WebUI.uploadFile works against <input type="file"...> elements. Be sure you are not clicking that element as well as calling WebUI.uploadFile on it.

Now I’m wondering if you have a timing issue – some systems can handle the test case “as is” but others need a little more time to “think” while switching controls in/out. Does that help any?

Also, I assume you’re not having popup/iframe issues, because the code is “sort of” working… right?

You’re welcome. Give the above some thought and let us know. And keep this in mind: WebDriver does not issue “random clicks” - there’s a reason you’re seeing what you’re seeing. Our job is to find out the cause (it’s there somewhere!)

Hi there! WebUI.uploadFile works against . I made sure that I’m not telling it to click in addition to using uploadFile.

It works like a champ on mine, but isn’t working on other people’s instances of Katalon. It could be a timing issue, I’ll have to try some things to see what happens. Sometimes it works, sometimes it doesn’t. The next step will be to run it a number of times to see how many times it fails. I’ll let you know the results!

Thanks again for your help!

1 Like

I added a few delays and it works every time now. Thank you very much!

1 Like

Excellent. Glad it’s working for you.