0

I wish to automate the form filling process using selenium.

I have coded Selenium to find element by xpath type. So it will fill in the field that has input type of text.

But the issue is, my form has multiple input type of text fields and selenium is only filling in the first field, leaving the other fields blank. How do I get selenium to fill in the next input type of text field as well?

Note: I am using python to code.

1 Answers1

0

Instead of using driver.find_element which returns the first element that matches the xpath, try to use driver.find_elements that returns a list of all matching elements.

inputs = driver.find_elements_by_xpath('//input[@type="text"]')
for input in inputs:
    fill(input)
ZhorGen
  • 41
  • 5