I am switching to WEBVIEW performing some functions,and again switching back to NATIVEAPP but elements are not located,when NATIVEAPP switch is done.
My code Snippet: Hybrid Switch
Set<String> getContexts=ElementsAction.driver.getContextHandles();
for(String setContext:getContexts)
{
System.out.println("get" +setContext);
if(setContext.contains("WEBVIEW"))
{
System.out.println("For WEB");
ElementsAction.driver.context(setContext);
System.out.println("setting content");
String title=ElementsAction.driver.findElementById("SS_DocumentTitle").getText();
System.out.println("The title is " +title);
ElementsAction.driver.context("NATIVE_APP");
System.out.println("switch to Native");
break;
}
One running the above code the NATIVEAPP switch is also done
Click on a Native App Elements, iam not able to locate the element and getting the below error on console
ElementsAction.driver.findElement(By.name(signOut_name)).click();
Getting this error in console on
info: [debug] Socket data being routed.
info: [debug] Got result from instruments: {“status”:0,“value”:""}
info: [debug] Condition unmet after 6391ms. Timing out.
info: [debug] Responding to client with error: {“status”:7,“value”:{“message”:“An element could not be located on the page using the given search parameters.”,“origValue”:""},“sessionId”:“25f9ea78-866d-434e-89d4-a6280e224ebf”}
info: <-- POST /wd/hub/session/25f9ea78-866d-434e-89d4-a6280e224ebf/element 500 6393.957 ms - 179
info: --> POST /wd/hub/session/25f9ea78-866d-434e-89d4-a6280e224ebf/element {“using”:“name”,“value”:“Sign Out”}
info: [debug] Waiting up to 0ms for condition
info: [debug] Pushing command to appium work queue: “au.getElementByName(‘Sign Out’)”
info: [debug] Sending command to instruments: au.getElementByName(‘Sign Out’)
Kindly help me