Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试为 Android 地图应用程序创建测试,但在运行测试时 GPS 无法以某种方式获取当前位置。要绕过,我需要插入一些 javascript 才能这样做。有人可以告诉我如何在机器人脚本中插入 javascript 代码吗?
谢谢。
It's quite easy:
private void injectJavaScriptCode(final WebView webView, final String code) { solo.getCurrentActivity().runOnUiThread(new Runnable() { public void run() { webView.loadUrl("javascript:" + code); } }); }