Currently I have a form with 10 fields that I need to do sendkeys > store the value and after assert this value when save the form. For each of these fields I need to create a function and store the value in a variable or is there a better way?
My actual code:
var email = driver.findElement(By.name('email'));
email.sendKeys('[email protected]');
email.getAttribute("value").then(function(email_text) {
var email = email_text;
});
Cheers, Rafael
If I understand correct, the process looks like you should fill some fields, remember their values and check values after the form has been submitted.
There is no one standard decision for tasks like this, it depends on developer.
So, we know which values we need and can store it for example in map
Key is name for finding element, value - for sendKey and checkValue methods.
You should write two methods, which will work with test data map and will fill inputs and check values in cycle by map keys.