Javascript Injection | Click a button that I cannot interrigate

I am trying to use Javascript injection for the first time with UI Path. I found a few good threads that talked about how it worked. Unfortunately most of the ones that did what I needed do not load properly for the examples given.

I have a button that I want to click. For some reason UI Path cannot hook into the button 90% of the time. The html of the button is always the same, but when I try to navigate to the button in UI Explorer (even tried crawling the page) UI Path just cannot see it. I was thinking this might be a good opportunity to try doing some JS injection. I already went over the documentation, really need a working example to understand how I would go about doing this. Any tips or thoughts welcome of course!

Button in question:
<input type="file" class="popupDataField" id="fileUpldFile" name="fileUpldFile" style="padding:0px;top:33px;left:28%;width:70%;height:20px" maxlength="254" autocomplete="off" autocorrect="off" tabindex="1">

I did a search in the hhtml and fileUpldFile id and name are unique to this one object.
I would be ok using another alternative click option if JS is not the best rout of course.

Hi @LeftBrainCo

Wouldn’t a simple workaround to use a TAB to navigate and Enter to press it with a Send Hotkey be a better solution here?

1 Like

It is a great idea, I tried it but tab will not go to that particular button.

I can select it when in debug mode of Chrome and see everything about the button.
On rare occasion UI Path can see the button, but fails to see it again after I relaunch the browser.
The elements in the selector always match, but the button does not click, and will not highlight if I click highlight when it’s broken.

How about Find Children activity to list all possible selectors for that window?

You could quickly check it like so:


what type of object do you assign item in this case?

UiPath.Core.UiElement for the For Each loop, I believe.

But the simplest way to find out every time is to use the Ctrl+K shortcut to create your variable from the properties panel of every activity. It will automatically assign the correct type :slight_smile:


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.