Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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
1  
Is there a reason why you want to do this? –  Phil Kirkham Apr 29 at 11:58
    
I am not sure about necessity of it but if you really need it then you can use EventFiringWebDriver stackoverflow.com/a/23787258/2504101 –  olyv Jun 11 at 13:01
add comment

5 Answers 5

up vote 2 down vote accepted

You can try setting implicit wait time. (Documentation)

// 5 seconds implicit wait (C# code)
IWebDriver driver = new FirefoxDriver();
driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
share|improve this answer
    
this can be accepted as answer –  Emmanuel Angelo.R May 3 at 11:20
add comment

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: https://www.youtube.com/watch?v=AudbOfamfwc

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
add comment

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? –  razizcool4all Apr 29 at 12:29
3  
Why do you want to slow the execution??? –  Phil Kirkham Apr 29 at 13:32
1  
Just to view on browser that whatever I wrote in script is performing well on browser. –  razizcool4all May 1 at 11:45
add comment

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
add comment

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? –  Mark0978 May 5 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 –  PaulDonny May 6 at 15:51
    
I'm guessing it's not available then.... –  Mark0978 May 6 at 15:54
2  
Sadly, no. I will edit and put the steps I used in order to create the UI in my post. It was really simple. –  PaulDonny May 6 at 16:09
add comment

Your Answer

 
discard

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.