从AccessibilityService在Chrome执行JavaScript [英] Execute Javascript in Chrome from AccessibilityService

查看:2640
本文介绍了从AccessibilityService在Chrome执行JavaScript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想写一个 AccessibilityService 这将有助于用户填写表单。我看到通过 WebView.loadUrl来调用JavaScript code的可能性()。但是,因为我刚刚在 AccessibilityNodeInfo 我只看到的WebView 显示在屏幕上。

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(). But since i've just the AccessibilityNodeInfo i only see that the WebView is on the screen.

经过一番研究,我看到TalkBackService能够注入Javascript脚本,并在不同的岗位(<一个href=\"http://stackoverflow.com/questions/15067853/alternative-way-for-communication-between-webview-and-native\">Alternative对的WebView和本地)之间的沟通方式,我看到了它的可能的,如果我必须在的WebView参考 -object。

After some research, i saw that TalkBackService is able to inject Javascript, and in a different post (Alternative way for communication between WebView and native) i saw its possible if i have a reference to the WebView-object.

有没有通过这样的消息或铬合金的WebView的广播意图执行JavaScript的方式?

Is there a way to execute JavaScript via such an Message or an Broadcast Intent in chromes WebView?

将是真正伟大如果有人可以帮助我!
非常感谢!

Would be really great if someone could help me! Thanks a lot!

推荐答案

浏览器不使用的WebView,Chrome会使用它自己的渲染引擎。虽然一些$ C $的c结束与所述web视图共享(如在两个端部向上被从同一源$ C ​​$ C编译)这就是其中的相似之处。

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.

我不认为有一种方法,通过一个Intent注入的JavaScript到浏览器 - 这将是一个pretty很大的安全漏洞(否则有人会注入一个给我你所有的钱的JavaScript到您的银行的页面)。

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).

辅助功能是不是我的专业领域,所以我可以完全关闭在这里,但我相信,Chrome浏览器新版本公开Web内容结构,以辅助层,因此,你应该能够做你的事没有任何自定义JavaScript。我想你可以检查此使用uiautomatorviewer:对我来说,工具显示HTML表单的时候我抓住Chrome的用户界面的转储。是不是你的情况?

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?

这篇关于从AccessibilityService在Chrome执行JavaScript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆