如何使用chrome中的javascript以编程方式发送密钥?
我试过这个:
x = document.getElementById("input");
x.dispatchEvent(new KeyboardEvent('keydown', {'keyCode':65, 'code': 'KeyA', 'key': 'a'}));
x.dispatchEvent(new KeyboardEvent('keypress', {'keyCode':97, 'charCode': 97, 'code': 'KeyA', 'key': 'a'}));
x.dispatchEvent(new KeyboardEvent('keyup', {'keyCode': 65, 'code': 'KeyA', 'key': 'a'}));
但输入不改变值,有什么帮助?