对于 executeScript API:executeScript(script/function, arg1, arg2, arg3, ...)
第一个参数是javascript sn-p或javascript函数,如果是javascript sn-p,它将被包装到executeScript内的javascript函数中。
下一个参数是 javascript 函数的参数,代表第一个参数。
arguments 是 javascript 函数内置功能。您可以在调用函数时使用它来获取真正的传入参数。请看下面的例子:
test('tom', 12, 'male', '175cm') // call function: test
function test(name, age) {
console.log(name); // tom
console.log(age); // 12
console.log(arguments); // ['tom', 12, 'male', '175cm']
console.log(arguments[0]); // equal to argument: name, so print tom
console.log(arguments[1]); // equal to argument: age, so print 12
console.log(arguments[2]); // male
console.log(arguments[3]); // 175cm
}
更多关于 Javascript 的细节Function.arguments