I'm trying to write javascript code that changes the value of an input field by using document.getElementById(“”).value, but the values are not really changing.
I'm testing it on some websites to check if it's working properly. When trying on Netflix (https://www.netflix.com/il-en/login) it's not working. This is how I do it:
document.getElementById("email").value = 'change@change.com' ;
document.getElementById("password").value = 'change1234' ;
Since this website has also "value attribute" i've tried:
document.getElementById("email").setAttribute('value', 'change@change.com');
document.getElementById("password").setAttribute('value', 'change1234');
See screenshot that shows that DOM and html input values are being changed properly
After changing the value and focusing on the input fields or just trying to click on the "sign-in" button i can see that the input field values are the old ones or nothing.
See screenshot of old values in UI website but in DOM the values I entered
.
Meaning that the values are not really being set to ones that I assign them.
Any idea why and how can I set the input fields values properly?
Thanks!