Modern design Check element always gives "true"

Hello,
I’m using Check element activity in a dynamic way:

property:

i want to check if the “Viewing records 1 - 15 of XXXX” reach a certain value
"“Viewing records 1 - 15 of YYYY”

Hi @abdel

Try using get text activity and then compare the required text with a if condition. This would be easier

Hope this helps!

Hi @abdel

it might be due to a too-broad selector or incorrect target. Just Fine tune the selector to be more specific or try to use Element Exists activity instead. Also, verify that the property you check (like innertext) exactly matches the expected value

(webctrl id=‘MultiNewUserContactUserControl gvfound’ tag=‘TABLE’ /> <webctrl tag=‘TD’ class=‘saname’ innertext=‘Viewing records 1 - 15 of " + intNbridsinBulk.ToString + "’ /

OR
Extract the displayed record count via Get Text. Compare with “YYYY” using an - If condition

happy automation

Here, it won’t be 1-15 of Xxx if there are less than 15 records on the screen. In that case selector will fail.

I would suggest below approach:

use ui explorer to explore the selector for XXX value. It most likely would be saving the value in aaname or inner text attribute.
then use get text activity to fetch its value and save its output.

Use if condition to compare XXX and YYY, then take further actions accordingly.

Hope this helps.

Regards
Sonali

Check Element is not for seeing if an element exists. It is for seeing if an element is enabled or disabled.

You should be using Check App State.

@abdel,

It should be happening due to non concreate selectors for this Check app state activity. This could also happen if the Ui Element is hidden, not visible to human eyes but it’s available in the HTML DOM object. Try to get the right selectors and this should work.

They aren’t using Check App State, they’re using Check Element which is the wrong activity to use.