New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sending 'Enter' key event on input field #226
Comments
Thanks! :) You're right, that doesn't work and the documentation isn't really helpful. I even tried several other combinations with no luck. You should ping the guys on the Google Group or file an issue to the official protocol repo. I don't know your use case but in the meantime you can achieve a similar effect with something like: Runtime.evaluate({
expression: `document.querySelector('#lst-ib').value = 'moe';
document.querySelector('#tsf').submit();`
}); |
Thank you the fastest reply :) I submitted issues in the both links you refer in your answer:
Your workaround code gives me another option and it is nice to have it. Feel free to close the issue, as it seems there is nothing more we can do for now. |
Working example
|
async pressedEnter() {
await Input.dispatchKeyEvent({ "type": "rawKeyDown", "windowsVirtualKeyCode": 13, "unmodifiedText": "\r", "text": "\r" })
await Input.dispatchKeyEvent({ "type": "char", "windowsVirtualKeyCode": 13, "unmodifiedText": "\r", "text": "\r" })
await Input.dispatchKeyEvent({ "type": "keyUp", "windowsVirtualKeyCode": 13, "unmodifiedText": "\r", "text": "\r" })
} it works for me |
Is Chrome running in a container? NO
First I want to thank you for the wonderful library and your efforts in closing the issues.
My issue is with firing 'Enter' key on input field.
I thought that the code
await Input.dispatchKeyEvent({ type: 'rawKeyDown', keyIdentifier: 'Enter' })
would work, but it did not.This is my code:
Any help will be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: