Switching to Webview context fails

I was automating an hybrid app, while switching, it only shows name native context. WebView Context is shown as webview_undefined.

Set<String>  contextNames = driver.getContextHandles(); for (String contextName : contextNames)  {      System.out.println(contextName);      if (contextName .contains("WEBVIEW"))      {          driver.context(contextName);          webViewFound = true;          System.out.println("switched to webview");     } } 

I'm using the above code. Can anyone give solution for this !

Replay

Dinesh, Give a try to below snippet

Set <String> handles =driver.getWindowHandles();
Iterator<String> it = handles.iterator();

String parent = it.next();
String child = it.next();

driver.switchTo().window(child);
//perform actions on child window

driver.close(); // only for child wondow

driver.switchTo().window(parent);
//perform actions on parent window

driver.quit(); // After execution of main thread and for parent window

Category: selenium Time: 2016-07-30 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.238 (s). 12 q(s)