Hello,
First of all this happens for the moment only on Android tablets for some reason.
I tried it on phones with Android 6.0 to 4.4 and it’s working.
But for some reason on tablets it doesn’t.
I’m trying to find an advertisement on the screen for this I’m searching it with either this :
private boolean findAdContainerDefault (){
boolean found = false;
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.widget.ViewSwitcher/android.widget.FrameLayout/android.webkit.WebView")));
found = true;
} catch (Exception e) {}
return found;
}
or this :
private boolean findAdContainerFor44 (){
boolean found = false;
try {
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//android.widget.ViewSwitcher/android.widget.FrameLayout/android.view.View")));
found = true;
} catch (Exception e) {}
return found;
}
since sometimes webview doesn’t show in the inspector for some devices.
This work like a charm on phones but for some reason on tablets it’s sometimes working sometimes not and if i’m using this methods 8 times in my test it might work 6 times & on the 7th crash everything even if I have a try catch over it.
And apparently it’s a server side error :
this is the error i get :
org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.xpath: //android.widget.ViewSwitcher/android.widget.FrameLayout/android.webkit.WebView)
org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 101 milliseconds
and this is what i get in the server side :
> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"xpath","selector":"//android.widget.ViewSwitcher/android.widget.FrameLayout/android.webkit.WebView","context":"","multiple":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"xpath","selector":"//android.widget.ViewSwitcher/android.widget.FrameLayout/android.webkit.WebView","context":"","multiple":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: find
> info: [debug] [BOOTSTRAP] [debug] Finding //android.widget.ViewSwitcher/android.widget.FrameLayout/android.webkit.WebView using XPATH with the contextId: multiple: false
> info: [debug] [BOOTSTRAP] [debug] Command returned error:java.lang.RuntimeException: Failed to Dump Window Hierarchy
> info: [debug] Condition unmet after 64ms. Timing out.
> info: [debug] Responding to client with error: {"status":13,"value":{"message":"An unknown server-side error occurred while processing the command.","origValue":"Failed to Dump Window Hierarchy"},"sessionId":"0552388e-e8d3-4be6-ba40-1e8225064654"}
> info: <-- POST /wd/hub/session/0552388e-e8d3-4be6-ba40-1e8225064654/element 500 66.384 ms - 200
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":13,"value":"Failed to Dump Window Hierarchy"}
Is it known bug or something ?
Is there a work around ?