-2

I would like to code how Firefox opens a website and clicks a button.

I would like Firefox to wait 30 mins and then close everything. I would like to loop this action.

from selenium.webdriver import Firefox

YOUR_PAGE_URL = 'http://www.websyndic.com/wv3/?qs=OTcxNzAw'
NEXT_BUTTON_XPATH = '/html/body/div[3]/div[3]/div[1]/div/div/div[3]/div/div/a'

browser = Firefox()
browser.get(YOUR_PAGE_URL)

button = browser.find_element_by_xpath(NEXT_BUTTON_XPATH)
button.click()
jmunsch
  • 22,771
  • 11
  • 93
  • 114
Chris
  • 1
  • 2
  • Possible duplicate of [How to make a Python script standalone executable to run without ANY dependency?](https://stackoverflow.com/questions/5458048/how-to-make-a-python-script-standalone-executable-to-run-without-any-dependency) – Bubble Bubble Bubble Gut Dec 07 '17 at 19:21
  • perhaps a `for` loop, or maybe a `while` loop? I could also see a `time.sleep` might do the trick? – jmunsch Dec 07 '17 at 19:39

1 Answers1

0

As per your code is concerned, I don't see any issue out there. Now if you want to loop and repeat the actions after any pre-defined interval there are a few options available as follows :

Looping Options :

  • You can use the ScheduledExecutorService Interface from java.util.concurrent
  • Use a Continous Integration tool like Jenkins to support building, deploying and automating any project.
  • You can use the functionalities extended by Windows Scheduler to start your Test Execution.
  • Configure a Cron Job to execute your Test Suite at pre-defined intervals.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352