Click a Button if the innertext is not "BLAH"

Ranorex Studio, Spy, Recorder, and Driver.
User avatar
CMeNot
Posts: 6
Joined: Wed Feb 06, 2019 4:12 pm

Click a Button if the innertext is not "BLAH"

Post by CMeNot » Mon Apr 25, 2022 3:49 pm

Hi All

I have a button in the web app I am testing that controls sort order "ascending/descending". The only difference in the XPath is the value of "title" it is either:
  • /dom[@domain='sailpoint:8443'].//button[@id='cardListSortDirectionBtn' and @title='Descending']/i[1]
  • /dom[@domain='sailpoint:8443'].//button[@id='cardListSortDirectionBtn' and @title='Ascending']/i[1]
What I would like to do is only click the button if the "Title" of the button is "Ascending" but I'm not real sure how to do that. Its like I want to do a "If 'Title' equals 'Ascending' then Invoke Action - PerformClick()". I am hoping that I do not have to write a User code block.

User avatar
CMeNot
Posts: 6
Joined: Wed Feb 06, 2019 4:12 pm

Re: Click a Button if the innertext is not "BLAH"

Post by CMeNot » Mon Apr 25, 2022 9:30 pm

Hi All

In the end I created "user code" that I pass two strings in and the repository item of the button to click. In side the user code I put a single if that test if the two strings passed in are equal. If so I then click on the button needed. Thanks to the Help pages on creating "user code" within a module that made doing this real easy.