How to inspect all elements in android webview

为君一笑 提交于 2019-12-24 18:28:15

问题


When i inspect an website with Chrome i can to see some iframe data like this: Example Chrome inspect

I did the following solutions :

  • I can inspect WebView to get iFrame element, but i cant Log these content (Like input tag, etc...).
  • I try to get new recaptcha token from iframe link, but received token not valid for its services.
  • I tried to get this amount of token using some JavaScript code but I always received null

it try to get all content by this code:

@Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            view.getSettings().setLoadsImagesAutomatically(true);
            Log.d(TAG, "onPageFinished: " + url);
            if (url.startsWith(MyApp.LOGIN_URL))
                chkLogin.postDelayed(() -> webView.loadUrl("javascript:window.HTMLOUT.processHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');"),300);

        }

But i got this result for iframes:

<iframe src="https://www.google.com/recaptcha/api2/anchor?ar=1&amp;k=-&amp;co=..&amp;hl=en&amp;v=&amp;size=invisible&amp;cb=j2nwbbdqkt4c" width="256" height="60" role="presentation" name="a-axd1alpz93t" frameborder="0" scrolling="no" sandbox="allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation allow-modals allow-popups-to-escape-sandbox">(no content in result)</iframe>

So, How to get iFrame Content in android WebView?

来源:https://stackoverflow.com/questions/59412314/how-to-inspect-all-elements-in-android-webview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!