-3
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.find_element_by_xpath("//input[@value='Continue >>']").click()
time.sleep(2.5)
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.find_element_by_xpath("//input[@value='Continue >>']").click()
time.sleep(2.5)
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.find_element_by_xpath("//input[@value='Continue >>']").click()
time.sleep(2.5)
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.find_element_by_xpath("//input[@value='Continue >>']").click()
time.sleep(2.5)
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.find_element_by_xpath("//input[@value='Continue >>']").click()
time.sleep(2.5)
driver.find_element_by_class_name("submit").click()
time.sleep(2.5)
driver.refresh()
1

You can change the script, putting code in a loop:

def submit_form():

   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.find_element_by_xpath("//input[@value='Continue >>']").click()
   time.sleep(2.5)
   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.find_element_by_xpath("//input[@value='Continue >>']").click()
   time.sleep(2.5)
   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.find_element_by_xpath("//input[@value='Continue >>']").click()
   time.sleep(2.5)
   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.find_element_by_xpath("//input[@value='Continue >>']").click()
   time.sleep(2.5)
   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.find_element_by_xpath("//input[@value='Continue >>']").click()
   time.sleep(2.5)
   driver.find_element_by_class_name("submit").click()
   time.sleep(2.5)
   driver.refresh()

[submit_form() for _ in range(0,5)] #Run the submit_form function 5 times
2
  • i tried the above code it doesnt work – pocket monster Apr 19 at 13:09
  • 1
    @pocketmonster give us more details. What does "it doesnt work" mean? It runs the code only for a single time or it throws exception? – Alexey R. Apr 19 at 13:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.