Skip to content

Instantly share code, notes, and snippets.

@yeisoncruz16
Last active August 19, 2021 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeisoncruz16/5c8197664070f8c3f4b4dad3f338e761 to your computer and use it in GitHub Desktop.
Save yeisoncruz16/5c8197664070f8c3f4b4dad3f338e761 to your computer and use it in GitHub Desktop.
How to update html field value when the page is using React
sendKeys(document.getElementById("SELECTOR_GO_HERE"), "My cool message to type", 'input');
const sendKeys = (targetObject, value, eventType) => {
targetObject.value = value;
let event = new Event(eventType, {target: targetObject, bubbles: true});
targetObject.dispatchEvent(event);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment