Problem with identifying the right UI element with the Click activity


Im using “For Each UI element” to retrieve a list of questions from Quora.

For each element i am doing certain tasks. One of the tasks is clicking on answer.

The problem is, some of the questions can’t be answered, so my “click” activity automatically chooses the asnwer button for the next question.

I want my UiPath to recognize that the current question does not have a Answer button and then go to next UIelement(in the “For Each UIelement” activity) instead of clicking on the next answer button.

I had some ideas, but i couldnt execute them correctly. I was thinking that if I could get the x,y coordinates of each UIelement in the “for each UIelement” activity. And if i could get the x,y coordinate of the Answer UIelement, then i could make a IF statement where the condition would be:

if y(current UIelement) - y(next UIelement) > y(current UIelement) - y(answer UI)
then click on answer button

Explaining my if statement: The logic behind this is that, in quora the vertical distance between the current question an the next question will allways be greater then the vertical distance between the current question and the its answer button.

BTW im new to this software i started 3 days ago

Hi @john_johnsen
Inside for each uielement,you could check the answer element is exists or not by using element exists and use if condition to perform the action if the answer element presents and do nothing if it doesn’t exist.

Hi, i dont have the"element exist" activity. do i need to install it somehow?

Hi @john_johnsen

Are you using modern design activities ?

Im using the latest update of Studio if that’s what you are asking?

You could use check app state activity instead of element exists @john_johnsen

i figured it out. i had to click on show classic activities in the “view options”. but thanks anyways :slight_smile:

Yes,it’s upto you to choose between classic and modern activities.