selenium - wait.until(ExpectedConditions.invisibilityOfElementLocated()) with @FindBy? -


why work?

public void mymethod(){     wait.until(expectedconditions.invisibilityofelementlocated(by.id("myid")); } 

and doesn't work? don't understand.

@findby (id="myid") webelement myid;  public mypagefactory(webdriver driver){     this.driver = driver;     pagefactory.initelements(driver); }  public void mymethod(){     wait.until(expectedconditions.invisibilityofelementlocated((by) myid)); } 

i keep getting "invalid cast" error on "(by)". i'm trying use page factory methodology.

the condition invisibilityofelementlocated expecting locator of type by, providing proxied webelement. use invisibilityofallelements instead:

wait.until(expectedconditions.invisibilityofallelements(arrays.aslist(myid))); 

Comments