Jump to content

Clicking dynamically injected buttons with no ID and no class name.


Floppy
 Share

Recommended Posts

Hello guys, I need some help!

I need to click a few buttons that are dynamically injected into a webpage after its loading. 

Here are 2 examples of these buttons:

<button type="button" class="btn btn-primary ng-isolate-scope" ng-enter="annulla()" ng-click="annulla()" analytics-category="lavagna" analytics-on="click" analytics-label="OkModal" analytics-event="click">OK</button>

<button type="button" tabindex="-1" class="btn btn-primary start-calculating pull-right" ng-disabled="wb.avvio" btn-loading="wb.avvio" data-loading-text="Avvio in corso…" ng-click="wb.startCalculator()" analytics-category="lavagna" analytics-on="click" analytics-event="click" analytics-label="StartCalculator">Start Calculating</button>

I think this is AngularJS, but maybe I'm wrong... I don't know...

However, I'm having some some difficulties because these buttons are not part of a Form and I cannot use _IEFormElementGetCollection, they don't have a name or an ID, and I cannot use _IETagNameGetCollection because the buttons are dynamically injected after the page is loaded.

I think I have 2 options:

  1. Use the "analytics-label" attribute. But the problem is: How can I click a button using the "analytics-label" attribute as soon as it is injected into the page?
  2. Click the buttons based on their color. They all are blue. The problem is that they have a gradient, so it's not plain blue. And another problem is that PixelSearch doesn't work in minimized windows.

Can someone help me please?

Link to comment
Share on other sites

14 hours ago, Danp2 said:

Are you sure? I would expect the function to work as long at the button exists at the time the function is called.

That's the problem. It doesn't work!

4 hours ago, junkew said:

Use iuiautomation udf that can handle most likely these buttons. Try with simplespy if they highlight. If they do they are clickable thru uiautomation. See FAQ31 link below for details and references

I tried it and it works. The problem is that it doesn't work when the window is minimized.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...