How to check for presence of elements/images

On visiting a website, we need to look for a particular element/image and if that is not present need to look for alternate element/image. How can we do that ?
Ex. Check for Element A/ Image A if not present
Look for element B/Image B if not present
Look for element C/Image C.


Use Element Exists activity and indicate that image and will give you Boolean value as result.

1 Like

Hope these steps would help you resolve this
—use a IMAGE EXISTS activity if we are trying to access a image or use ELEMENT EXISTS activity if the element we are looking to access can be chosen as a individual element
—both of the activity gives us a Boolean variable as output and let’s name it bool_element
—now followed by using any of these activities use a IF condition like this
bool_element = True
If this condition is true that is the element or image if exists it will go to THEN apart where we can go ahead with other process if element or image exists
If the above condition fails it will go to ELSE part where use another ELEMENT EXISTS activity or IMAGE EXISTS activity and choose another element or image and get the output with a Boolean variable named bool_element_2

—now STILL being inside the ELSE part after the above ELEMENT EXISTS OR IMAGE EXISTS use Another if condition and validate the second Boolean variable like this
bool_element_2 = True
If true it will go to THEN part or to ELSE part

Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @ajitbhatt

1 Like

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