If statement help

Hello, I am trying to use an if statement to click a link if it exists and if it does not then to close tab. I am wondering how in the if statement, it will recognize the boolean statement and click the link whenever it appears. The “type into” above the delay is what is being looked for when searched, and if the hyperlink appears it can be clicked, if not the tab will close.

Please let me know if anyone has any tips! Thanks.

Just give it as OfferLetter @sam1313,

as it is a boolean variable, just assign the value as false before checking if the element exists, and then check the condition. If condition will take the boolean, so if you give only the OfferLetter variable, it will go to then condition if the variable is true or it navigates to else

Fine lets go one by one

yes usually IF activity will look for boolean type, so either mentioning OfferLetter = True or just OfferLetter will work
the reason is the variable OfferLetter is a boolean which will be either true or false which is wat if condition actually takes in as a condition

Then this

Though i didnt get this sequence correctly in concern to the process, i hope you have used a element exists to check whether that html exists or not prior validating with Click activity.

Hope this would help you
Cheers @sam1313

I changed the true to false as you said and the link was recognized. However, when the link is not present, the tab does not close (the else aspect). Any advice? Thank you again.

kindly use a ELEMENT EXISTS activity and check for the html text
–while selecting the element for the activity element exists, select that html text as element
and the output of this activity is a boolean type and name it bool_element
–now use that in the if condition like bool_element
if the condition passes it will go to THEN part where we can click that same element
or will go to ELSE part where we can leave it empty

hope this would helpyou
Cheers @sam1313

1 Like

Thank you so much. That helped a ton. Cheers!

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