title: JavascriptExecutor with document.evaluate xpath to change className
body: <p>I try to change class name in Java(webdriver, selenium) of
  element:</p>
  
  <pre><code>&lt;span class="myclass" role="button"&gt;mytext&lt;/span&gt;
  </code></pre>
  
  <p>Java code:</p>
  
  <pre><code>((JavascriptExecutor) driver).executeScript("document.getElementsByClassName('myclass')[0].className='clearr'");
  ((JavascriptExecutor) driver).executeScript("document.getElementsByTagName('mytext').className='clearr'");
  ((JavascriptExecutor) driver).executeScript("document.evaluate('//span[@class='myclass'][text()='mytext']', document, null, XPathResult.ANY_TYPE, null).className='clearr'");
  </code></pre>
  
  <p>1'st option is working good and change 1'st class 'myclass' name to 'clearr', but class 'myclass' is in many places and I need to use xpath=//*[@class='myclass'][text()='mytext']</p>
  
  <p>2nd - I don't have fail but nothing happen. Still classname='myclass'</p>
  
  <p>3th option: Fail</p>
  
  <p>How can I make it work to get
  element:</p>
  
  <pre><code>&lt;span class="clearr" role="button"&gt;mytext&lt;/span&gt;
  </code></pre>