我正在尝试在appium-java客户端中使用appium后门,但是由于语法无效而引发了异常。有人可以帮助我确认这个问题吗?
driver.executeScript("mobile:backdoor", "{target: 'com.learn.android.Settings', methods: [{name: 'setclient' , args: [{value: '10.10.10.10:1010', type: 'java.lang.String'}] }, {name: 'setserver', args: [{value: '19.19.19.19:1919', type: 'java.lang.String'}] }] }");
我尝试使用哈希图,但仍然无法成功
HashMap<String, Object> param = new HashMap<String, Object>();
param.put("target", "com.learn.android.Settings");
param.put("methods", "[{\n" +
" \t\t\"name\": \"setclient\",\n" +
" \t\t\"args\": [{\n" +
" \t\t\t\"value\": \"10.10.10.10:1010\",\n" +
" \t\t\t\"type\": \"java.lang.String\"\n" +
" \t\t}]\n" +
" \t},\n" +
" \t{\n" +
" \t\t\"name\": \"setserver\",\n" +
" \t\t\"args\": [{\n" +
" \t\t\t\"value\": \"19.19.19.19:1919\",\n" +
" \t\t\t\"type\": \"java.lang.String\"\n" +
" \t\t}]\n" +
" \t}\n" +
" ]");
driver.executeScript("mobile:backdoor", param);
感谢您的支持。
答案 0 :(得分:0)
能够找到答案
ImmutableMap<String, Object> scriptArgs = ImmutableMap.of(
"target", "application",
"methods", Arrays.asList(ImmutableMap.of(
"name", "setclient",
"args", Arrays.asList(ImmutableMap.of(
"value", "2.2.2.2",
"type", "String"
))
))
);
driver.executeScript("mobile: backdoor", scriptArgs);