Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to reduce the speed for execution of script so that I can view the execution properly on browser. I want do this in webdriver.

share|improve this question
Is there a reason why you want to do this? – Phil Kirkham Apr 29 '14 at 11:58
I am not sure about necessity of it but if you really need it then you can use EventFiringWebDriver – olyv Jun 11 '14 at 13:01
up vote 6 down vote accepted

You can try setting implicit wait time. (Documentation)

// 5 seconds implicit wait (C# code)
IWebDriver driver = new FirefoxDriver();
share|improve this answer

This is how I would debug a Selenium session to find out what is happening:

Step-by-step debugging: Most IDE's allow you todo step-by-step debugging, you could set a break point just before the point you want to investigate. This will pause the execution of the test and lets you examine the browser with its own tools. You can step thru each line of code one by one and monitor the behaviour. See this video for an example:

Video recording: Record the test session with a screen-recorder or use one of the online Selenium grids like Sauce labs or TestingBot, both offer recording of the test session by default and give enough free minutes to analyse most issue's. After the recording you can playback frame by frame.

Sleeps: Like others suggest, you can add sleeps or increase the default wait-times. Personally I am not a fan of this because you might need to rerun the test a couple of times if the sleeps are not long enough.

share|improve this answer

You could put a sleep after every instruction - or around the instructions you are interested in.

share|improve this answer
I can use sleep that is not something which I am looking for. I want to slow the execution. I don't want to pause it. In Selenium IDE we were having option to control it. Is there any property in selenium web driver for this? – Ashwani Raj Apr 29 '14 at 12:29
Why do you want to slow the execution??? – Phil Kirkham Apr 29 '14 at 13:32
Just to view on browser that whatever I wrote in script is performing well on browser. – Ashwani Raj May 1 '14 at 11:45

Some tools allow for defining before scenario, after scenario, before step, after step - hooks, which are called as a setup or teardown for a scenario or even for a separate step in it. If you do have such hooks, then add a delay into an "after step" hook and you'll be fine.

share|improve this answer

There is several different ways to do this. I personally have a UI that controls my automation script that allows me to go step by step (in record mode or playback), full automation or however I like. Just build a UI to control the flow and then have different functions that can be controlled by the UI as needed.

For example, a step by step UI would do a function called nextStep() nextStep would find the next desired step and perform that action.

A fully automated one would check a boolean for true while automating and as long as it's true, it keeps going. Set up a pause/stop button that changes that boolean and that is done.

In order to create functionality like this, in a simplistic way:

Create a UI that lists out your test steps, how you do this is up to you. I made mine editable and drag and drop within a table (JTree for Suites, JList for Cases, JTable for Steps).

Add Stop and Play ToggleButtons on the UI in a button group Add an actionEventListener to the play button that grabs the selected step(s) and runs them. Between each step have it check that the play button is still selected. When it is no longer selected, the execution will stop.

For things like groovy script just add in a groovy console and create a trigger (IE. Keyword being Groovy=script) and then have the console parse that whenever it sees it.

I also added in keywords like screenshot, pause, wait and such. This gives the ability for the system to stop automatically until user intervention occurs.

share|improve this answer
Of what tool do you speak? Does it interface with webdriver? – boatcoder May 5 '14 at 21:37
It is a custom built system that A) Dynamically records flows B) Allows the end user to Edit the flows and add Groovy script to the test case C) Controls the runs of the flows and yes, it is built on top of the WebDriver – Paul Muir May 6 '14 at 15:51
I'm guessing it's not available then.... – boatcoder May 6 '14 at 15:54
Sadly, no. I will edit and put the steps I used in order to create the UI in my post. It was really simple. – Paul Muir May 6 '14 at 16:09

The easiest way to do that in selenium webdriver is to extend your prefered WebDriver (e.g. FirefoxDriver) and override the execute methods.

Write a Thread.sleep(yourWaitTime) in every execute method before return.

Voila there is your speed reduce:

protected Response execute(String driverCommand, Map<String, ?> parameters) {
    try {
        // wait 500 millis and after that run command
    } catch (InterruptedException ex) {}
    return super.execute(driverCommand, parameters);
share|improve this answer
Whats the added value over using the accepted answer? ImplicitlyWait setting does the same, not? – Niels van Reijmersdal Jun 8 '15 at 10:08

Firefox selenium web extension has an option to make the test run slower or faster using a sliding bar. Not sure if IE or Chrome has this if not i would just use the debugger.

share|improve this answer

By looking at your question I have one possible solution for you.

If your test platform supports it, try adding priority to each test method, because multiple @Test methods run in parallel.

share|improve this answer
How does this add to or improve on the accepted answer? – Kate Paulk Oct 5 '15 at 11:21

Your Answer


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

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