Fluentwait with AppiumDriver

In order to handle the elements that are not yet displayed on the screen i have used the below fluentwait function with selenium webdriver.
Now i am automating Native iOS/Android but for some reason when searching for an element that isn’t display i expect it to search it for 45 seconds however it seems that it attempt to search it once & then it fails.
any help will be most appreciated!

public WebElement fluentwait(AppiumDriver driver, final By byType){
Wait wait = new FluentWait(driver)
.withTimeout(45, TimeUnit.SECONDS)
.pollingEvery(5, TimeUnit.SECONDS)
.ignoring(NoSuchElementException.class);
WebElement foo = wait.until(new Function<AppiumDriver, WebElement>() {
public WebElement apply(AppiumDriver driver) {
return driver.findElement(byType);
}
});
wait.until(ExpectedConditions.elementToBeClickable(byType));
return foo;
}

Hmm can you post logs, with timestamps?

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (Original error: XPath parse error) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.09 seconds
Build info: version: ‘2.42.2’, revision: ‘6a6995d’, time: ‘2014-06-03 17:42:30’
System info: host: ‘menyz.local’, ip: ‘192.168.1.100’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.9.4’, java.version: ‘1.7.0_51’
Session ID: d00f0941-ec62-4513-bfce-1802d56b22e2
Driver info: io.appium.java_client.AppiumDriver
Capabilities [{platform=MAC, app=/Users/qa/Desktop/Appium/Pogoplug.ipa, javascriptEnabled=true, browserName=iOS, networkConnectionEnabled=false, udid=dc32ad3627707abcf57c9844d4ed95e4c212e5a9, desired={platform=Mac, app=/Users/qa/Desktop/Appium/Pogoplug.ipa, deviceName=QA’s iPhone, platformName=iOS, device=iPhone 5, udid=dc32ad3627707abcf57c9844d4ed95e4c212e5a9, version=7.1.2}, locationContextEnabled=false, version=7.1.2, databaseEnabled=false, platformName=iOS, deviceName=QA’s iPhone, webStorageEnabled=false, device=iPhone 5, warnings={}, takesScreenshot=true}]
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:204)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:156)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:599)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:95)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:352)
at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:449)
at org.openqa.selenium.By$ByXPath.findElement(By.java:357)
at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:344)
at com.pp.webui.auto.GenericMethods$1.apply(GenericMethods.java:845)
at com.pp.webui.auto.GenericMethods$1.apply(GenericMethods.java:1)
at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:208)
at com.pp.webui.auto.GenericMethods.fluentwait(GenericMethods.java:843)
at com.pp.webui.auto.GenericMethods.clickXpth(GenericMethods.java:577)
at com.pp.webui.auto.sanityNativeIosAppium.testLogin(sanityNativeIosAppium.java:136)
… Removed 28 stack frames

Even i have been facing similar issue…and appium throws similar logs…

Any Solution??

Problem solved,
seems that the xpath i used was incorrect or invalid & i saw that there was a parsing error in the Appium server.
once i have fixed the xpath the problem solved.

1 Like