0

I want to completely stop my script from executing at a certain step for X seconds before continuing. I tried time.sleep(), I tried Seleinum implicit waits, I tried flushing the output, and my script still continues executing and outputting during the "sleep" period.

Basically I have the following:

Make AJAX call to PHP file -> PHP file runs Python script with arguments -> Python connects using Selenium -> Python/Selenium does something and needs to stop for X seconds before continuing.

I tried numerous ways and it always keeps running despite the sleep method.

Help please.

Neekoy
  • 2,325
  • 5
  • 29
  • 48
  • 3
    in python this should work `import time time.sleep(5)` if it doesn't we need to see code and more details –  Jul 05 '15 at 21:56
  • 1
    see if [this](http://stackoverflow.com/questions/6694981/selenium-ide-command-to-wait-for-5-seconds) and [this](http://stackoverflow.com/questions/20009211/getting-selenium-to-pause-for-x-seconds) help – Pynchia Jul 05 '15 at 22:10

1 Answers1

0

Turns out that I have been doing it the other way around and that was the reason it wasn't working. You need to flush and then sleep, in order for it to work properly. The following syntax worked in the end:

sys.stdout.flush()
sleep(180)

I haven't tested however I would assume that it would work in the same way with Selenium implicit waits too.

Neekoy
  • 2,325
  • 5
  • 29
  • 48