How to use Check App state to look for one of multiple similar objects?

I have a web form I’m trying to enter info into. There are multiple INPUTs. If any of the entries are invalid, alerts appear as SPANs under whichever field is wrong.

image

A general selector that will find any of these elements is:

<webctrl aria-role='alert' tag='SPAN' />

When I use Check App State and use that as the selector, it doesn’t find the element if more than one is visible on the screen (ie more than one field has an entry error). It seems to me it should return true if any element is found matching the selector, but it only works if there is exactly ONE.

Hey @postwick

This should have worked !

Can you try with regex selector may be !

Thanks
#nK

Hello @postwick ,

Will that be possible to link that to an anchor? If you have multiple input boxes and few are throwing error, then it would be better to add an anchor.

Try to use App/Web recorder and check.

You’re not understanding. It works fine if there is only one error on the page. But if there is more than one that match the selector it doesn’t detect any of them, it goes to the “does not appear” branch. All I’m looking for is “is there one or more errors” but it only works if it’s ONE.

1 Like

Hey @postwick

Could you please show the selector once in full.

Thanks
#nK

I did.

<webctrl aria-role='alert' tag='SPAN' />

If there is ONE object on the page that matches, it works. If there are no objects on the page that match, it works. If there are two or more, it doesn’t work. With two or more, it acts like there are none.

Hey @postwick

Is that the only selector you are using there is no top level selector ?

Thanks
#nK

It’s inside a Use App/Browser so it inherits the top level scope. None of that is the issue. The selector is correct. The issue is that it works if there are none, works if there is one, but when there is more than one it acts as if there are none. And this is not expected behavior.

Hey @postwick

Is that a public site ?

Will try to test from my side.

Thanks
#nK

No it is not a public site. It’s a Sharepoint form.

Find any web page with multiple similar objects and use a selector that should find any of them.

Hey @postwick

This is what I tried…

image

image

image

As you know our forum has many rows and post div elements, So just tried with it works fine !

Thanks
#nK

It doesn’t work.

image

Hey @postwick

I have used the Selector target method.

Why are you using Fuzzy Selector please ?

Thanks
#nK

To point out that it doesn’t work, but should.

Hey @postwick

What is the match percentage you were using ?

Thanks
#nK

I’m not using Image selection.

Interesting use case. If I got it right, the Check App State was designed to find the state of one specific element, which might indeed prevent you from “batch” checking multiple errors at once.

But I might be wrong here, maybe it is a bug. I’ll tag @gheorghestan for more input :slight_smile:

As we wait for more input, I got a small suggestion that enabling just the strict selector with the current selector could work as you expect. Could you please give it a try?

Yes we determined that this works. Fuzzy selector doesn’t work, regular selector does. Seems like both should work. Also, being able to explicitly define multiple selectors so Check App State can simultaneously look for multiple objects, would be great.