title: How to wait for invisibility of an element through PageFactory using Selenium and Java
body: <p>Is there a way to wait for an element not present in Selenium using PageFactory annotations?</p>
  
  <p>When using: </p>
  
  <pre><code>@FindBy(css= '#loading-content')
  WebElement pleaseWait;
  </code></pre>
  
  <p>to locate the element, and then:</p>
  
  <pre><code>wait.until(ExpectedConditions.invisibilityOfElementLocated(pleaseWait));
  </code></pre>
  
  <p>I would get:</p>
  
  <pre><code>org.opeqa.selenium.WebElement cannot be converted to org.openqa.selenium.By
  </code></pre>
  
  <p>I am able to do what I need by using:</p>
  
  <pre><code>wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector('loading-content')));
  </code></pre>
  
  <p>However, I would like to be able to use the PageFactory annotations in order to keep the framework consistent. Is there a way to do this?</p>