Simple selector on website

Hello everyone,

I have some kind of error. Im processing records on website and sometimes im dealing with error, it looks like this:
Error1

I can check if this “DIV” have some txt inside of it for example “ERROR!” so when its empty i know that there is no error.
The problem is that sometimes i find this type of error:
Error2

as you can notice there is no text inside of it so i cant check if “DIV” contains any text.

Here i attach code from website:

I want to check if display is “none” or “block” because if there is “block” then i know that error window is on screen, but then its “none” - i know that there is no error.

So how to check it? I tried selector like:

<webctrl id=‘InfoDiv’ tag=‘DIV’ css-selector=‘display: block’ />

and its not working, so i tried this one:

<webctrl id=‘InfoDiv’ tag=‘DIV’ style=‘display: block’ />

still not working.

Any ideas?

Thanks for your reply.

Hi,

shouldn’t the get text return nothing or empty if error text is not present?

this DIV is always present on website let me explain:

1.We have text inside for example “ERROR1” and “display: block” ← it means that we have an visible error like on screen number 1
2.We have no text inside this DIV but “display: block” like on screen number 2, this means that “get text” return empty string but I have still error on website.

The thing is that i have to check if display is none so whenever “display: block” then it means that there is an error.

Not really sure if I understood yet. You have error when there is text and when there is no text?
You could try the selector with wildcards added, so it’s basically a contains method:
style='*display: block*'

I tried this style=‘display: block even css-selector=‘display: block the problem is noone works.

Imagine that when you enter website you have DIV inside code. When there is no error “aaname” is empty. Sure i could check it by using “get text” activity and if its empty there is no error. But as you can see on images there is type of error that shows this “DIV” with empty string. So i cant check it by “get text” activity because error can contain no text. The only way to check this error is by checking if display is none or block in CSS on website.

From the ‘code from website’ picture it appears the the ‘style’ is an attribute of the element. So try Get Attribute -activity with “style”. Then check if the returning string contains “display: block”.

I used get attribute also but it returns empty string.

If you view the element with UiExplorer can you find the ‘display: block’ text anywhere in the property explorer?

Thats the problem, when I use UIExplorer on this ‘DIV’
Error1

all I have is:

error4

So it seems that uiexplorer cant find anything connected to CSS

Please see this thread How to Wait Until the CSS attribute changes
You can use Get Attribute Activity to Get “relativeVisibility” of that element.

2 Likes

Thank you! That was exactly what i needed!
NOW IT WORKS!