title: Using IF commands to Check if a button exists in Selenium Java
body: <p>I have a java selenium program that automatically presses on a button in a website. The code i am using looks like this :</p>
  <pre><code>driver.findElement(By.id(&quot;button&quot;)).click();
  </code></pre>
  <p>I want the program to use if statements if possible.</p>
  <p>Thanks for your help.</p>