Unable to get page source of an activity using driver.getPageSource()


I am using an Hybrid App. It is printing below values when I am printing it’s context. I am trying to click on a Native button whose class is ‘android.widget.Button’.

Even tried getting the pageSource to check if there is any issue but it is struck forerver when executing driver.getPageSource() command.

Please suggest how to fix this.


Also, is it possible to have ‘android.widget.Button’ inside the WebView?


I am able to find the element. I have two WebViews inside my application.

After switching to the correct WebView, I am able to find the element. But nothing happens in the app when click() method invoked on this WebElement.

Any suggestions?