How can I run Selenium (used through Capybara) at a lower speed?

后端 未结 5 768
天命终不由人
天命终不由人 2020-12-24 09:15

By default Selenium runs as fast as possible through the scenarios I defined using Cucumber. I would like to set it to run at a lower speed, so I am able to capture a video

5条回答
  •  不思量自难忘°
    2020-12-24 10:16

    This will work, and is less brittle (for some small value of "less")

    require 'selenium-webdriver'
    module ::Selenium::WebDriver::Remote
      class Bridge
        alias_method :old_execute, :execute
        def execute(*args)
          sleep(0.1)
          old_execute(*args)
        end
      end
    end
    

提交回复
热议问题