As you can see, when I click on the Read and Like count underneath the first article it is able to detect the ui element and detect the text inside.
I want to change the “Text is” selector to a variable.
However as soon as I change the text to a variable, or a specific text for that matter, it no longer detects any corresponding ui element:
Here the get OCR Text succefully recognises the element I want to click (see console write line), but when I input the same element into the selector it no longer works.
Variables are supported only during runtime…you would see that error generally when you use variable in selector and try to validate
Did you try indicating it using for each ui element? That should be working I believe…try to indicate in for each ui element and inside that use click or get text using currentElement
Hi Anil, thanks for taking the time to respond to my post.
In my post I included a screenshot of the console output after runtime and although the text I am trying to pass as my variable in the selector is successfully detected and extracted (check output : xxx read(s) yyy like(s)), when I input it as my variable it isn’t able to detect it (error message in console).
The “For each UI element” activity is restricted solely to web applications, or at least that’s the error message that pops up when I try to use it. So since I am using a desktop app here, I am not able to use it.
Anyways thanks again for your time aand if you have any more suggestions I would gladly hear them!
Yeah I’ve tried using strict selectors, fuzzy selectors. Still not working.
Another method I’ve tried is I’ve used “Get Text” activity and it worked perfectly. However, the problem with that is that when you scroll too far down it’s not able to recognise any more text, so it’s not applicable in my case since I want a clicker scroller bot that’s able to go on indefinitely, or until you hit the end. You can go check my other post for more context on this method if you like. It might be more confusing that constructive though.
So I’m not sure why variable passing from “Get Text” to “Click” works but not from “Get OCR Text” and “Click”. Also (maybe) worth noting that I used Tesseract for Get text and im using Google Vision for Get OCR Text.
Here’s another screenshot of the UI Explorer for another Read and Like count I’m trying to click on.
Just to mention the “Get OCR Text” successfully recognises all these elements. Just not able to click on them which is frustrating.
If your selector works with a static text, but not with a variable containing that exact text during dev but you do want to validate it you can:
→ put your variable value as a default value in the variable block. This way the selector validators will use that value during non-runtime validations.
→ be sure to put the variable name between double accolades if you edit the selector manually: text=“{{var_name}}”
I am recognising text using Get OCR Text activity. Then I store the recognised text in a variable, then I pass that variable into my selector. Check this screenshot :
You can see I also use wildcard asterisks so that If the case doesn’t match exactly it should still detect.
Thanks, I’ve put the variable between double accolades and even added wildcard asterisk so that in case the case doesn’t match exactly it should still detect and click on text that has the same “form”. Still no luck.