I'm a technical tester and I'm trying to create a javascript that autofill a form with some data so I can automate this process. The code is very simple:
document.getElementById("id1").value = 'test';
document.getElementById("id2").value = 'test';
...
But in this form there is some Angular code that set some fields mandatory and as far as I see, it uses the class "form-control ng-untouched ng-pristine ng-invalid". The problem is after I run my javascript in the console it sets the value but when I click on the submit button (that trigger something which will write the data into the DB) it tells me that those fields are mandatory like I didn't actually fill the fields and if for example I manually add a letter in one of the fields, it takes this specific field as "filled" and it works.
For some reason the document.getElementById("id1").value = 'test' doesn't actually set the value in the field.
I hope it's clear, i'm not an expert of it but trying to learn and automate my tests. Is there something I can do using Javascript because I don't have contact with the Angular developer.
Right now what I have try is editing the class "form-control ng-untouched ng-pristine ng-invalid" to "form-control ng-untouched ng-pristine ng-valid". It removes the mandatory clause but it's only a visualization thing because still the issue
Thank you in advance