How to check the value in the source code?

Dear UI Vision community,

I’m new to UI Vision, and I want to ask about this problem.
I have to do with a website, and there is a field, that:

  • If it meets the requirements, it will show the check symbol, the source code would be fa-check.
  • If it’s not, it will show the x symbol, the the source code would be fa-times.
    Down here is the image:

I want to do like this:

  1. Check if it’s a x one or a check one.
  2. If it’s x, go back with a go_ifv2 to do it again.
  3. If it’s check, then go to the next command.

I’ve already known to do all the go_ifv2 stuff. But I just don’t know how to verify if it’s x or check. I have thought about checking the source code.

Please help. Thank you all.

Best solution is storexpathcount but before to use it you need to find a good xpath, alternative solution is sourcesearch

1 Like

Dear @newuserkantu
The xpath in this is not quite good. It doesn’t show the text in side.
Actually, I want to verify if the tags field is empty, if it’s empty, the loop will go back to fill it.
I’m trying this:

      "Command": "executeScript_Sandbox",
      "Target": "\"//*[@id='product_uploader']/div[5]/div\").value != ''",
      "Value": "true",
      "Description": ""

But it said
Error in executeScript_Sandbox code: is not a function .

Please tell me how can I write it right. Thank you.

I figure it out, with Sourcesearch, thank to @newuserkantu

Can you post the macro code with the command can be useful to other user in the forum, thanks

1 Like

Okay, thank you for telling me that.

So in this case, when the requirements are satisfied, x would be turned into check, while the source code wil be changed from fa fas fa-times into fa fas fa-check.
So all I have to do is to count the number of fa fas fa-check of the tags section.
If the result is 0, then it’s unchecked, and the loop command will go back to do it all again, until it’s 1. For more details, down here is the code:

label | label1 |

[Here is where you put the commands so it will meet the requirements]

sourceSearch | regex=/<i class="fa fas fa-check" id="visibility-score__tags"></i>/i | yourvar

gotoIf_v2 | ${yourvar} != 1 | label1

In the code up there, the code is gonna break down like this:
regex=/the source code you are trying to count/i

It has to be like this. I’m not familiar with programming basic knowledge but more of a copycat person, so I don’t really know how to explain it for you guys to truly understand this. I just know that it’ll work.

1 Like