title: How to click on image/button using java selenium chromedriver
body: <p>I would like to clik one button, as of now I'm using a XPATH, but sometime the page is changed and I've to update the XPATH. </p>
  
  <p>I'm checking a different way (search and click a image like play.png, click by text, etc.), in order to obtain same result.</p>
  
  <p>Following the portion of the HTML code:</p>
  
  <pre><code>&lt;button class="btn btn-green false"&gt;PLAY&lt;/button&gt;
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I've tried with the code </p>
  
  <pre><code>driver.findElement(By.xpath("//*[contains(text(),’PLAY’]")).click();
  </code></pre>
  
  <p>but it goes in exception</p>
  
  <pre><code>Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: By.xpath: //*[contains(text(),’PLAY’] (tried for 10 second(s) with 500 milliseconds interval)
  at org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95)
  at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272)
  at seleniumTest.TestSelenium.play(TestSelenium.java:300)
  at seleniumTest.TestSelenium.open_url(TestSelenium.java:277)
  at seleniumTest.TestSelenium.seleniumTest(TestSelenium.java:108)
  at seleniumTest.TestSelenium.main(TestSelenium.java:85)
  
  Caused by: org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression //*[contains(text(),’PLAY’] because of the following error:
  
  SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//*[contains(text(),’PLAY’]' is not a valid XPath expression.
  </code></pre>