question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Click on button not taking input from text field?

See original GitHub issue

Iā€™m entering information into a text field then trying to click a button to enter the information, using

     const result = await Runtime.evaluate({
        expression: 'new Promise((resolve) => {document.getElementById("name-field").value = "name"})',
        awaitPromise: true
    });
    result = await Runtime.evaluate({
        expression: 'new Promise((resolve) => {document.getElementsByClassName("submitButton")[0].click()})',
        awaitPromise: true
    });

And after I click the button the input fields either havenā€™t loaded or are wiped outā€¦? (I know this works in the UI Iā€™m pointing it out). So my thought was that I needed to do something to wait until the input is done, but I thought thatā€™s what the ā€˜new Promiseā€¦awaitPromiseā€™ was doing?

If I print a screenshot before I click the button the input is there, and if I print a screenshot after I click it itā€™s no longer there (the form entry fails because itā€™s empty).

Also, neither ā€˜resultā€™ yields an error.

Component Version
Operating system Ubuntu 18.04.3 LTS
Node.js 12.12.0
Chrome/Chromium/ā€¦ 78.0.3904.108
chrome-remote-interface 0.28.0

Is Chrome running in a container? NO

P.S. Thank you for this wonderful tool! Itā€™s been awesome to work with šŸ˜„

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jvanniercommented, Dec 10, 2019

YESSSSS!! That works!! OwO Thank you!! šŸ˜„

0reactions
jvanniercommented, Dec 10, 2019

I was missing the ā€˜awaitā€™ on the focus šŸ¤¦ā€ā™‚ Sorry about that. Thanks again!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enable the input text field on clicking of a button - Stack Overflow
The issue is with the disabled property that you have added to your input tags, alreadySetVal1 and alreadySetVal2 .
Read more >
HTMLElement.focus() - Web APIs | MDN
Select the button to set focus on the text field. Focus on a button. This example demonstrates how you can set the focus...
Read more >
How to put a responsive clear button inside HTML input text field
The responsive button inside an input field will clear the text area on the click event. In this article, we will discuss how...
Read more >
How to Get an Input Value on Button Click in React
We set an onChange event handler on the input field to make this handler get called whenever the input value changes. In the...
Read more >
How To Trigger Button Click on Enter - W3Schools
Get the input field var input = document.getElementById("myInput"); // Execute a function when the user presses a key on the keyboard input.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found