WebDriverWait issue for AndroidElement

The below method can’t peform for 1.8, but it can use for 1.7.2
public boolean waitForAeAppear(AndroidElement androidElement, int timeOutInSeconds) {
try {
WebDriverWait wait = new WebDriverWait(aDriver, timeOutInSeconds);
wait.until(ExpectedConditions.visibilityOf(androidElement));
return true;
} catch (Exception e) {
return false;
}
}

I am seeing the same issue having just upgraded to 1.8 the following code is throwing “An element could not be located on the page using the given search parameters…” immediately on being called.

        var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.DefaultTimeout));
        wait.Until( x => x.FindElement(By.XPath(String.Format("//*[@text='{0}']", textToWaitFor))));

If I try to use
driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(Constants.DefaultTimeout);
I get an exception “Parameters were incorrect. We wanted “W3C protocol expects any of script, pageLoad or implicit to be set” and you sent {“type”:“implicit”,“ms”:60000}”

Does anyone have any suggestions how to wait for an element short of downgrading?

If you are using java client 6.0.0 BETA 5, check the link below:

… I implemented it like shown in this case (by creating a class like FakeElement) and it works perfect.

The way you are calling wait.Until:

var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(Constants.DefaultTimeout));
wait.Until( x => x.FindElement(By.XPath(String.Format(“//*[@text=‘{0}’]”, textToWaitFor))));

… x.FindElement will return null, which is not expected. Wait.util is expecting TRUE or FALSE and until false is returned, it will be trying to call again (Except if timeout hits). Check my comment above how you can solve it by creating “FakeElement” class.

I hope this helps.

i used below c# code for webdriver wait. it’s working fine.

WebDriverWait Wait = new WebDriverWait(driver, TimeSpan.FromMinutes(2));

Wait.Until(ExpectedConditions.ElementToBeClickable(By.Id(“yourid”)));
driver.FindElement(By.Id(“yourid”)).Click();