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.

Enter does not clear the current value of the field

See original GitHub issue

Below a small output part of a test. I am trying to change the value of the field Achternaam, but I can’t get it cleared.

|script | browser test|
|ensure | is visible | Achternaam|
|check | value of | id=aanvrager1.achternaam | Vriez|
|enter | Iets anders | as | id=aanvrager1.achternaam|
|check | value of | id=aanvrager1.achternaam | [VriezIets anders] expected [Iets anders]|

Can anyone explain why the enter command is not clearing the value of the field first? I really have no clue.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
fhoebencommented, May 10, 2019

Try placing the following scenario above your script (or in your ScenarioLibrary page):

|scenario|enter _ as _ |value, field|
|click|@{field}|
|select all|
|press|back_space|
|type|@{value}|

It empties the field by selecting its contents and sending a backspace keypress (instead of trying to use Selenium magic which sometimes fails with JavaScript) and then typing the value desired.

1reaction
tcnhcommented, May 10, 2019

I’m guessing some javascript that is executed on focus of the input field is causing trouble

you could try clicking id=aanvrager1.achternaam before you enter the new value. If that works,it’s probably some async javascript you should wait for first.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Clear Input Field on Focus - W3Schools
Click on the input field to clear it: Clear Input Field on Focus. Example. <!-- When the input field gets focus, replace its...
Read more >
HTML | Clearing the input field - GeeksforGeeks
To clear the entire input field without having to delete the whole thing ... input present in the input field, that the user...
Read more >
HTML how to clear input using javascript? - Stack Overflow
CODE EXPLAINED: When the text box has focus, clear the value. When text box is not focused AND when the box is blank,...
Read more >
Clear Input fields after Submit using JavaScript | bobbyhadz
To clear an input field after submitting, add a `click` event listener to a button. When the button is clicked, set the input...
Read more >
How to Clear Input Fields in JavaScript - Linux Hint
The “reset()” method clears all the values of the form elements. This method can be implemented to clear the input field holding text...
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