Help with selectors studio

How can I retrieve dynamic values for same box in browser?
The box validates if the values is true or not and depending of the reponse the selector is different. ‘resposta1’ for true and ‘resposta2’ for false.

Trying to get this values and store it but if I use the “get text” actitivy it will return me always the selector from “Reposta1”

Flow would be: Type into > Get text > store

ConfereCPF.xaml (11.8 KB)

1 Like

Maybe you can try using 'Element exists" activity and use the selectors for resposta1. If element exists then you store the response as true and if not, then false.


Hi @Meu_Eu_Nando

So you basically need id attribute from the selector right? You can use Get attribute activity and pass “id” as the attribute name. Please let us know if this helps else we can check for other options


1 Like

So a tried to use element exists using a pick branch activity but still not getting the proper response.

Maybe could you show an example of a workflow ?
Many thanks so far

@Meu_Eu_Nando if you are trying yo identify which message is howing based on the id you can use get attribute activity as susggested by @Lak_Ui … Drag and drop the activity and indicate on the element. Then select attribute as “id”

It will give you the id value as the output. You can use it for validation.

1 Like

How do I use it for validation after getting the attribute?
Do I user “Element exists” after ? Sorry, begginer in UiPath.
Maybe could you show me an example.
I need to enter this website (Validar CPF | Clevert) an extract the information given by the CPFs.
Example of valid CPF: 341.356.120-08
Example of invalid CPF: 111.176.600-87

Hello @Meu_Eu_Nando

After getting the id use an if condition,
If(var=” resposta1”), then use get text with this attribute, else get text with resposta2

var is the output variable of GetAttribute qctivity

1 Like

I see now. Thank you. I’ll apply this and feedback later

Still not getting the correct reponse for the “resposta2”

@Meu_Eu_Nando plz share the screenshot of the workflow which you have modified and the selectors which you set.

ConfereCPF.xaml (15.5 KB)

@Meu_Eu_Nando Did you tested in debug mode and by enabling Highlight?
If not plz try and confirm how the floe is happening. If any error please share the error also.

1 Like

Hi, I opened the workflow you have attached and found that you are always getting resposta1 because the selector in itself is assigned to resposta1

Aside from that, I have also found out that element exists is also unusable as resposta1 and resposta2 always exists at the same time, it is just that one is hidden and one is shown depending on the result. I have used another attribute which is the inner text. Please see attached workflow, which has worked for me.

ConfereCPF_mod.xaml (21.6 KB)


It’s working now. Thank you very much! Tricky one :smiley:
Now i need to set the invalid CPF as BRE. Will work on it but do you have any tips ?
Thanks bro

What is BRE?
Basically you can do what is needed on the valid and invalid side of the if activity

Business Rule Exception.

I see, then you can just put a Throw activity on the invalid side with the exception as

new BusinessRuleException(“Your message here. For example, The CPF is invalid!”)

1 Like

Ok. I’ll try and feedback you.
Thanks a lot for nice help so far. Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.