I am trying to go through each DIV element, write some data and finally click submit. However, I am not sure why but writing the values and click the submit button is always on the same element.
for example:
<div id="random_id" class="section">
  Last name:<br>
  <input type="text" id="lastname"><br><br>
  <input type="submit" value="Submit" id="submit">
</div>
 <div id="random_id" class="section">
    Last name:<br>
    <input type="text" id="lastname"><br><br>
    <input type="submit" value="Submit" id="submit">
</div>
<div id="random_id" class="section">
    Last name:<br>
    <input type="text" id="lastname"><br><br>
    <input type="submit" value="Submit" id="submit">
</div>
<div id="random_id" class="section">
    Last name:<br>
    <input type="text" id="lastname"><br><br>
    <input type="submit" value="Submit" id="submit">
</div>
I wrote the following python script to loop all sections, fill data inside and click submit.
elements = driver.find_elements_by_xpath("//div[@class='section']")
for element in elements:
    element.find_element_by_xpath("//div[@id='section']").send_keys("hello world")
    element.find_element_by_xpath("//div[@id='submit']").click()
When I run the script, only the first element is filled and clicked for 3 times.