Floppy Posted September 7, 2017 Share Posted September 7, 2017 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: 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? 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 More sharing options...
Danp2 Posted September 7, 2017 Share Posted September 7, 2017 4 hours ago, Floppy said: I cannot use _IETagNameGetCollection because the buttons are dynamically injected after the page is loaded. Are you sure? I would expect the function to work as long at the button exists at the time the function is called. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted September 8, 2017 Share Posted September 8, 2017 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 FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Floppy Posted September 8, 2017 Author Share Posted September 8, 2017 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 More sharing options...
Danp2 Posted September 8, 2017 Share Posted September 8, 2017 1 hour ago, Floppy said: That's the problem. It doesn't work! Can you show us your code or a small reproducer that demonstrates the issue? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
junkew Posted September 8, 2017 Share Posted September 8, 2017 Why run in a minimized way? Best then is to run your stuff in a virtual machine. Then you are not having these problems. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now