Unable to capture "Choose File" as button object

I don’t have much knowledge on using DevTools, thanks for the tip :slight_smile:

Right, so that is telling us the element identified by that selector does not actually exist. I got that selector from you:

image

All we did was fix it up to work in the DevTools console. But Chrome is saying the element it identifies doesn’t exist - did you make sure the element was present on the page?

I hate race conditions - I’ll back off until @kazurayam is done.

On my PC, I have Firefox at
C:\Program Files\Mozilla Firefox\firefox.exe
and I can run my test with Firefox successfully.

How come you have Firefox installed at %USERPROFILE%\AppData\Local\Mozilla Firefox. …

By the way, the following doc describes how Gecko Driver searches for the binary of Firefox browser:


@simona.bara

Can you just tentatively copy the Mozilla Firefox folder under C:\Program Files? and try running your test.

I need admin rights to copy the Mozilla Firefox elsewhere, I’m using my company laptop. When installing it I was also required admin rights, but hit cancel and got installed anyways (probably not properly).
I will raise IT ticket for an admin to help me with credentials and come back here with the test result.

As this document describes

the GeckoDriver look into the Windows REGISTRY

HKEY_LOCAL_MACHINE\SOFTWARE\Mozilla\Mozilla Firefox\ *[VERSION]* \Main\PathToExe

to find out the location of firefox.exe as default.

@simona.bara

Can you use regedit.exe and see what value you have for that registry key?

If the registry key is not pointing the correct location of firefox.exe, you can edit it.

Hi kazurayam,
Was able to properly install Firefox now and execute the test, here’s the result: FirefoxOutput.txt (17.5 KB)
Katalon still couldn’t click Choose File (Firefox showing “Browse”).

Sorry forgot to include your debug printing: FirefoxOutputUpdated.txt (18.2 KB)

Thank you for updates.

FirefoxOutput.txt contained an interesting message:

Caused by: org.openqa.selenium.InvalidArgumentException: 
    Cannot click <input type=file> elements

I googled with this message as key. I found an issue in StackOverflow.

The W3C WebDriver Specification, in its description of the Element Click algorithm in Section 14.1, step 3 states: “If the element is an input element in the file upload state1 return error with error code invalid argument.”

When the Chromium team completes spec-compliance for chromedriver, it will behave as geckodriver, IEDriverServer.exe, the current preview version of Microsoft’s driver implementation for Edge, and Apple’s just released driver implementation for Safari 12 all behave.

To successfully upload files using WebDriver, you should use the sendKeys method with the full path to the file you want to upload.

The above post tells us that any Selenium-base test script can not click the <input type="file"> element at all. That’s a correct behaviour as the W3C Specification defines.

Wow, here comes a Monster! I have never seen it. But I can guess a reason why.

If a browser opens a FileChooser dialogue when I click the <input type="file"> element using WebDriver, then how can I continue interacting with the dialog? — Nothing I can do. I can not interact with the OS-built-in FileChoose dialogue with WebDriver (=Katalon Studio) at all. Therefore I do not want the dialogue to open. Rather I want to send a file path to upload, and immediately go ahead.

It was a good learning. Thank you.

Thanks, kazurayam. After finding the mechanism behind the Monster doesn’t seem so scary anymore, hehe!
Therefore my only option would be using Upload File keyword with input on the full path of file I want to upload, am I correct?

Possibly you want this: