Need help looping until an element is disabled

Hi everyone,

Still relatively new to UI Vision, so any help is greatly appreciated.

I’m enhancing an existing script whereby I conduct several actions, click on a button and then perform the same actions once again (looping every time that the button is available to select). The number of times the button needs to be clicked varies on each execution (thus needs to be flexible every time).

This is what the button element looks like when it can be clicked.

< button class=“paginate-next-btn” ng-click=“vm.next()” ng-disabled=“vm.checkForDisabled(!vm.canGoForward)” id=“paginate-next-btn”> 

This is what the button element looks like when it cannot be clicked.

< button class=“paginate-next-btn” ng-click=“vm.next()” ng-disabled=“vm.checkForDisabled(!vm.canGoForward)” id=“paginate-next-btn” disabled=“disabled”> 

What type of commands need to be used to detect if the element is disabled as well as loop through?

Any help is greatly appreciated!
Thanks in advance,
Sam

A few ideas:

  • storeAttribute | …@disabled

  • sourceSearch | disabled=“disabled”>

  • visualVerify | ButtonImage.png

1 Like

Hey @ulrich

Thanks for the reply - sourceSearch managed to help me do the trick!

A simplified description of what I’ve done can be found below…

Command | Target | Value:

  • sourceSearch | < button class… > | NextButtonDisabled (The value is ‘0’ as it’s not available)
  • While_V2 | ${NextButtonDisabled} <= 0 | BLANK
  • …The rest of my script…
  • sourceSearch | < button class… > | NextButtonDisabled (The value eventually ends up being ‘2’ as it appears twice when looping through the script; the script then ends)
  • End

Many thanks!
Sam

Hello,

I do not know if it is the same but I had to do a loop, where if the object did not appear it changed the query until it found it. I don’t know how to explain it to you, but I used Times because it was with a CSV, GotoIF for the condition and verifyelementnot present for the IF validation.