RE: Loop Automation Script?

Hi All.

I am using Chromedriver to automate a form but I want to loop my code so that it
runs infinitely.

E.g РReloads page, runs code and repeats.  How can I achieve this with what i have so far?


from selenium import webdriver

from selenium.webdriver.common.keys import Keys

from import By

browser = webdriver.Chrome()
elem = browser.find_element_by_id('quantity');


elem = browser.find_element_by_id('area');

elem.send_keys('mobile' + Keys.RETURN);

elem = browser.find_element_by_id('submit-button');


t2t Default Asked on February 4, 2016 in Selenium WebDriver.
Add Comment
1 Answers

Nice to see some Python snippet.

Well, when you speak the word- Indefinite then it will raise some eyebrows.

In Java we could do something like:

while (1) {

//Do whatever you want to do


But proper way to achieve it will be use CI like- Jenkins
> Install Jenkins on server
> Go to your test
> Convert it into Maven runnable test
[In case of Python make it runnable using PIP, i guess]
> Call executable using Shell or windows batch file
I guess in your case:

Train Answered on February 4, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.