Trying to use IF statement

I want to create a IF statement to use. What would be the best way to insert it in my code?

I want it to click IF the button appears, but if it doesn’t then continue.