I have a list of text fields each having the same class names. This is the html code:
each text field has the same class name and I am trying to automate the fields by sending keys to each text field by using the sendKeys method in selenium. I am using JavaScript(chai,mocha,node) to run my automation.
<div>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1">adad</textarea>
<textarea class="form-control textarea-multi" name="191_table_1">adadad</textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
<textarea class="form-control textarea-multi" name="191_table_1"></textarea>
</div>
This is what I tried. I tried to use findElements by className and iterate through of the className and then fill the each text field:
describe('complete text fields',function(){
it('fill all the text fields',function(done){
driver.findElements(By.css("input[type=\'form-control textarea-multi\']")).then(function(texts){
console.log("got the list of texts");
texts.forEach(function(textField){
console.log("sending keys for each of the text field");
textField.sendKeys("test");
count = Number(count) + 1;
console.log(count);
if(count === 6) {
done();
}
});
});
});
});
but it fails with a time out error. (Error: Timeout of 15000ms exceeded.) Any help will be greatly appreciated Thank you in advance.