how to get webview from AccessibilityNodeInfo

陌路散爱 提交于 2019-12-07 23:18:49

问题


I am creating an application in which i need to use AccessibilityService. And there is no problem to get get the window content of other applications. I have detected all available child from the window content and the child are showing in AccessibilityNodeInfo. Now I have a webview in AccessibilityNodeInfo And i need to get the URL of that WebView but there is no way to convert the AccessibilityNodeInfo into the relevant View.

Is there any way to get the webview from AccessibilityNodeInfo ?


回答1:


No, because the WebView is in another process, not yours.




回答2:


There is not a way to access all of the properties of the WebView, as a WebView. AccessibilityNodeInfo objects are completely separate from the objects that they represent.

However, since you are in control of the application, you could easily provide this information in the content description of one of the elements of your application, which would then easily be accessed by your Accessibility Service. Just be sure not to break the general accessibility of your application, when using this somewhat hackish solution.

Note: I would question the design decisions that lead you to this line of thinking. Perhaps a more general description of what you're trying to do, would allow us (the Stack Overflow community) to suggest a better way of accomplishing similar things.



来源:https://stackoverflow.com/questions/33318083/how-to-get-webview-from-accessibilitynodeinfo

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