let input = document.getElementById('username'); let lastValue = input.value; input.value = '6d915519acf411e9b502fa528da74700'; let event = new Event('input', { bubbles: true }); // hack React16 内部定义了 descriptor 拦截 value, 此处重置状态 let tracker = input._valueTracker; if (tracker) { tracker.setValue(lastValue); } input.dispatchEvent(event); input = document.getElementById('password'); lastValue = input.value; input.value = '3'; // hack React16 内部定义了 descriptor 拦截 value, 此处重置状态 let tracker1 = input._valueTracker; if (tracker1) { tracker1.setValue(lastValue); } input.dispatchEvent(event); document.getElementsByClassName('ant-btn login-form-button ant-btn-primary')[0].click()