Execute Javascript in Chrome from AccessibilityService

前端 未结 1 873
北恋
北恋 2021-01-18 11:45

i want to write an AccessibilityService which should help the user to fill forms. I saw the possibility to call Javascript code via WebView.loadUrl()

相关标签:
1条回答
  • 2021-01-18 12:11

    Chrome doesn't use a WebView, Chrome uses it's own rendering engine. While some of the code ends up being shared with the WebView (as in the two end up being compiled from the same source code) that's where the similarity ends.

    I don't think there is a way to inject JavaScript into Chrome via an Intent - that would be a pretty big security hole (otherwise someone could inject a "send me all your money" JavaScript into your bank's page).

    Accessibility is not my area of expertise so I can be totally off here but I believe newer versions of Chrome expose the web contents structure to the accessibility layer and therefore you should be able to do your thing without any custom JavaScript. I think you can check this using uiautomatorviewer: for me the tool shows html forms when I grab a dump of Chrome's UI. Is that not the case for you?

    0 讨论(0)
提交回复
热议问题