title: WebDriverWait for an element attribute to change
body: <p>How can I use WebDriverWait to wait until an attribute changes? </p>
  
  <p>In my AUT I have to wait for a button to become enabled before continuing, unfortunately due to the way the developer coded the page I can't use WebElement's isEnabled() method. The developer is using some CSS to just make the button look like it's disabled so the user can't click on it and the method isEnabled always returns true for me. So what I have to do is get the attribute "aria-disabled" and check whether the text is "true" or "false". What I've been doing so far is a for loop with Thread.sleep, something like this:</p>
  
  <pre><code>for(int i=0; i&lt;6; ++i){
      WebElement button = driver.findElement(By.xpath("xpath"));
      String enabled = button.getText()
      if(enabled.equals("true")){ break; }
      Thread.sleep(10000);
   }
  </code></pre>
  
  <p>(disregard the code above if incorrect, just pseudo code of what I'm doing)</p>
  
  <p>I'm sure there's a way to achieve something similar using WebDriverWait which is the preferred method I just can't figure out how. This is what I'm trying to achieve even though the following won't work:</p>
  
  <pre><code>WebDriverWait wait = new WebDriverWait(driver, 60);
  wait.until(ExpectedConditions.visibilityOf(refresh.getText() == "true")); 
  </code></pre>
  
  <p>Obviously it doesn't work because the function is expecting a WebElement not String but it's what I'm trying to evaluate. Any ideas?    </p>