Is there any way we can slow down the execution of Watir WebDriver under Cucumber?
I would like to visually track the actions performed by Watir. At the moment, it goes too fast for my eyes.
Is there any way we can slow down the execution of Watir WebDriver under Cucumber?
I would like to visually track the actions performed by Watir. At the moment, it goes too fast for my eyes.
Not universally. You could Monkey Patch the element_call method to add a sleep after every interaction with a Selenium Element. Import this code after requiring watir-webdriver.
Also note, that Monkey Patching is generally a bad idea, and when I change the implementation (which I plan to), this code will break.
While Watir itself does not have an API for slowing down the execution, you could use the underlying Selenium-WebDriver's
AbstractEventListener
to add pauses before/after certain types of actions.Given you want to see the result of actions, you probably want to pause after changing values and clicking elements. This would be done by creating the following
AbstractEventListener
and passing it in when creating the browser:For a full list of events that you can listen for, see the Selenium::WebDriver::Support::AbstractEventListener documentation.