I'm new to Selenium so I'm not sure if this is the best way to approach the problem, but I'm looking for a way to use xpath (or css) to locate a series of input elements and somehow iterate over all of them and input some text into them.
Something like the following:
<form>
value1 <input type="text" placeholder="value1"><br>
value2 <input type="text" placeholder="value2"><br>
value3 <input type="text" placeholder="value3"><br>
</form>
I am able to locate the elements using this:
var input = driver.findElement(By.xpath("//input[@type='text']"))
I can input the first occurrence of the element found by xpath with the following:
input.sendKeys('Some text')
That's where I get stuck. I'm not sure how to enter values into the input fields after the first.
Ultimately, what I'd like to do is somehow send the text to all of the input fields located by the xpath filter. I was thinking it might be possible with a for loop but I'm not sure how to do it with the promise manager that webdriverjs uses.
Is this possible or is there a better way to do this?