Get text giving text even if text is not there on UI


I have a scenario where I want to fetch a text from UI, if a text is found then need to proceed with if block, if not found then go to else part.
For this I have used Get Text activity like below.

It is giving Add MSPQ as result in both the cases. Meaning, if Add MSPQ button is not present then also it is giving result as Add MSPQ.

Can someone please help me with this.

in such scenarios we can observe, that an element is set to non display (e.g. CSS Property display:none; direct or on some parent element). So it is not shown, but will be found.

We would recommend to analyse this more in detail e.g. UiExplorer / Browser F12 Webtools

I have tried using CSS selectors for this, but it is still not working. Is there any way to handle this?

give us more details on what was done. thanks

@ppr This doesn’t work for me. Please refer below link, we had a discussion on this.

Perfect, so coming back to the analysis task. Did you find the element triggering the display? As mentioned, it also can be an element on upper parent level

Hi @Riya_Bansal ,

Could you check by using UiExplorer what would be the difference in the Properties/Attributes when the text is present for that element and when the text is not present ?

This may be able to help us find the right attribute and use it for decision making.

When text is not present

when text is present

@Riya_Bansal ,

Also Perform a check in the Left Panel Property Explorer :


when text not present

when text is present

kindly note:

  • from the important left side attribute panel, we only see the upper part from scroll content, but not all
  • we recommend ensuring always that the panel is updated (click any element in the visual tree and click back to the element for panel refreshing)

as mentioned more often: the trigger for display is also to search on other elements.


  • div#tabcontent
    • div#wrapper
    • button#OK

in many seen implementations the trigger is for example on div#tabcontent level as here the entire content is displayed/hidden.

So include this also in your inspections