title: How to check that a value is set on a dropdown box selenium java
body: <p>I have a HTML code. The thing is that the option names contain lots of spaces until the tags are closed.</p>
  
  <pre><code>&lt;SELECT NAME="auth" id="auth" Size=1 onChange="updatePageState()"&gt;
  &lt;OPTION value="0"&gt;Open System
  &lt;/option&gt;
  &lt;OPTION value="1"&gt;WEP
  &lt;/option&gt;
  &lt;OPTION value="2"&gt;WPA
  &lt;/option&gt;
  &lt;OPTION value="3"&gt;WPA2
  &lt;/option&gt;
  </code></pre>
  
  <p>I want to check that some option is selected in the dropdown box by using selenium in java. This is my code:</p>
  
  <pre><code>try {
      WebDriverWait wait = new WebDriverWait(driver, 20);
      wait.until(ExpectedConditions.textToBePresentInElementValue(((By.xpath("//select [@id='auth']/option['" + Authen + "']"))), Authen));
      System.out.println("Authentification is correct");
  } catch (Exception x) {
      System.out.println("Authentification is incorrect");
      x.printStackTrace();
  }
  </code></pre>
  
  <p>where "Authen" is a variable read from a file which corresponds to the options in the dropdown box. </p>
  
  <p>I get the following error message:</p>
  
  <blockquote>
    <p>org.openqa.selenium.TimeoutException: Timed out after 20 seconds
    waiting for text ('WPA2') to be the value of element located by
    By.xpath: //select [@id='auth']/option['WPA2']</p>
  </blockquote>
  
  <p>Any help on how to check if that string contains partial text? I cannot use the method <em>.contains</em> because it's of type boolean and <em>.textToBePresentInElementValue</em> needs to have the second attribute as type String.</p>