mercredi 13 février 2019

Wait for element not present in Selenium and PageFactory

Is there a way to wait for element not present in Selenium using PageFactory annotations?

When using

@FindBy(css= '#loading-content')
WebElement pleaseWait;

to locate the element, and then

wait.until(ExpectedConditions.invisibilityOfElementLocated(pleaseWait));

I would get

org.opeqa.selenium.WebElement cannot be converted to org.openqa.selenium.By

I am able to do what I need by using

wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector('loading-content')));

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?

Aucun commentaire:

Enregistrer un commentaire