Upgrade with more context: Selenium 1 had a command called "setSpeed". This allowed to slow down the execution of each command in X milliseconds. The team behind Selenium 2 (Webdriver) decided to abandon this team, and now there is no way to slow down the tests for working at speeds where it is easy to visually control the application at run time. I read the explanations of the developers about why they were deprecated, as well as suggested workarounds such as using implicit_waits, but this does not solve the problem for me (or other people complaining about obsolescence). However, I was hoping to get around this by setting a global execution speed that would apply either to each method in unittest, or to the entire test suite.
The original subject: I have different unit tests that I would like to run using different delays between the teams. I know that I can continue to copy and paste time.sleep between commands, but of course, is there a way to simply set a universal sleep that will be executed before each command in the specified method?
def test_x_test(self): driver = self.driver time.sleep(2) print("running the First selenium command such as click button") time.sleep(2) print("running another Selenium command such as click link ") time.sleep(2) self.driver.quit() if __name__ == '__main__': unittest.main()
source share