I am trying to test Hybrid App with Selendroid. When I am switching to Web View with
driver.switchTo().window("WEBVIEW");
it does not give any error on switching , however , my application hangs and do not open any web page.
What could be the problem?
Asked
Active
Viewed 124 times
1
-
When run manually, pages in webview are getting open. – MKay Aug 10 '15 at 07:24
-
1Could you do try this. String nr = driver.getWindowHandles().toString(); System.out.print(nr); There might be an issue that the app has multiple webviews. Then you need to switch a specific webview. driver.switchTo().window("WEBVIEW_0"); Example – Madis Kangro Aug 10 '15 at 07:31
-
@Madis Kangro : Yes , there are 2 WEBVIEWS :[NATIVE_APP, WEBVIEW_1, WEBVIEW_0] I think I would require developer's help to switch to desired view to get the selendroid working. – MKay Aug 10 '15 at 07:50
-
1Try either one of these 2. driver.switchTo().window("WEBVIEW_0") or driver.switchTo().window("WEBVIEW_1") – Madis Kangro Aug 10 '15 at 07:55
-
@Madis Kangro : Thanks now application is proceeding further and opening a page. But now selendroid is not able to find out the element I am trying to search with : driver.findElement(By.id("input_firstname")).sendKeys("first_name"); – MKay Aug 10 '15 at 09:19
-
What does the selendroid inspector say. – Madis Kangro Aug 10 '15 at 09:59
-
It Says : org.openqa.selenium.NoSuchElementException: Element was not found. Driver info: io.selendroid.client.SelendroidDriver Capabilities [{aut=
, automationName=selendroid, browserName=selendroid, platformName=android, platform=ANY}] Session ID: e2062b17-5ee9-5ecc-5cd5-5d5fbd6b901f *** Element info: {Using=id, value=first_name} – MKay Aug 10 '15 at 10:05 -
I'll be honest. I can't help you with that anymore. I don't have access to the app your testing so I dont have any clue if id selector is correct etc. You can try with to check if the element is there, at that moment. http://localhost:4444/inspector/ Also upvote my comment for other viewers incase they run also in the same problem – Madis Kangro Aug 10 '15 at 10:33
-
@Madis : On checking further, I observed that , WebView.setWebContentsDebuggingEnabled(boolean); was not set. I made it to true and now able to find the elements of web page loading in webview of app. However I am facing strange issue for which I would create new question. Thank you for help. – MKay Aug 12 '15 at 09:01