1

What if I need to pause the automation script and play it dynamically. just like a music player.

  • What do you mean by "play it dynamically"? What would be an example of playing it dynamically vs. playing it not dynamically? – user246 Oct 14 '16 at 16:22
  • i mean to say i need to stop the automation script in between at any point of time and then resume from there onwards – Jatin khurana Oct 14 '16 at 16:24
  • 2
    It would be easier to understand and answer your question if you could update your question to contain some context. Like why you want to stop it and what for actions you would like to preform. Explaining the flow of your application and test maybe. We could even come with an alternative solution. – Niels van Reijmersdal Oct 14 '16 at 17:21
2

Running tests from an IDE should give you the possibility to use a debugger. You can set a breakpoint in the IDE. When you run the test in debug mode and hit the point of the breakpoint the test will stop executing the next commands of the code. When the debugger stops executing the code at the breakpoint you should be able to play freely with the browser. In the IDE you can continue the code again when you are done investigating.

So in your analogy the breakpoint is the pause button and the continue button of the IDE is the play button. You can set as many breakpoints as you like. Some IDE's even support pausing the playback of the code at any point in time.

Each programming language and IDE should support the debugging process. How to set it up for your tools is another question. I suggest you ask help from your development team.

Keep in mind Selenium-server has a session time-out of 30 minutes, so you must continue playback within 30 minutes.

|improve this answer|||||
2

You did not specify an operating system. On Linux, you can suspend any running process like this:

kill -SIGTSTP PID

where PID is the ID of the process. To resume the process, do this:

kill -SIGCONT PID

You can do a similar thing on Mac OS:

kill -STOP PID
kill -CONT PID

I don't know about Windows.

|improve this answer|||||
  • I think you cannot interact with the process if you stop it, or can you? Still its intressting – Niels van Reijmersdal Oct 14 '16 at 21:21
  • @NielsvanReijmersdal No, you can't interact with it when it's stopped. – user246 Oct 14 '16 at 21:44
-1

In .net use driver.sleep(-what ever the time you want to pause the test-);

After time ends, test will automatically start.

|improve this answer|||||
  • that is what we are asking where to stop but what i want is to stop at any point of time and any number of times. – Jatin khurana Oct 14 '16 at 16:26
  • Yeah. any point, any number of time.Its better to stop after completing your test steps,like at the test cleanup stage. – ChathuD Oct 14 '16 at 16:32
  • no bro, in your way we are giving it before running where, when, and how much to stop. but i need it at run time. – Jatin khurana Oct 14 '16 at 16:34
  • Please explain it bit more.At this point i cant understand what you are trying to implement. – ChathuD Oct 14 '16 at 16:41
  • ok let me try again. take a music player analogy, we can play and pause a song at any point of time in the same way I need to play and pause the program under execution is it fine ? – Jatin khurana Oct 14 '16 at 16:43

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