Working with found or not found elements

I was looking for a way to drive a decision of the appearance or the lack of appearance of a web element. So, On a website, I request a file download and if the file exist I get a save file prompt from the browser. If not you get nothing. So, I wanted to make a decision using and IF Statement if the Save file browse element appears. If not I wish to move on. So I chose Element Exist to determine if the Browser Save file element appears and added a boolean variable as the Output. The IF statement looks to see if the Variable is true before moving forward either attempting to save the file or skipping it. This works if the Save file element appears but dies if it doesn’t. If ‘Element Exist’ is not the proper approach what would be?


@WarrenBowman What do you mean “dies if it doesn’t”?

@WarrenBowman Best guess from your description, in my experience, “Find Element” is likely more what you are looking for.

For one, you can return the element as an object and continue from there, but, also, the activity is designed to wait until the element appears. By default, 30 seconds. If your element should be appearing sooner, you can lessen this timeout, to say, 500ms or whatever is appropriate.

Since it is a valid result if this doesn’t pop-up, then you can set “Continue on Error” to true. End results could be:

FoundElement = Element found (which you can then reference in your code
FoundElement = NULL when no element is found

Then use logic/branching from there to continue your code.

I’ll try it thanks. Using Find Element, If I output to a boolean Variable will it automatically make it true?

@WarrenBowman No; it only accepts a UIElement variable type - however, you can check IsNull on the variable to get a True/False check.

Thanks Sagacity. Will do.