driver.getPageSource() = nothing? try:
public boolean switchToWebView() {
for(Object context : driver.getContextHandles()) {
System.out.println("Context Name is " + context.toString());
if(context.toString().contains("WEBVIEW")){
driver.context(context.toString());
return true;
}
}
return false;
}
and then driver.getPageSource() again