Is there a way to slow down execution of Watir Webdriver under Cucumber?

后端 未结 2 1008
遇见更好的自我
遇见更好的自我 2020-12-22 09:23

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 g

2条回答
  •  臣服心动
    2020-12-22 09:54

    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.

    module Watir
      class Element
        alias_method :watir_element_call, :element_call
        def element_call &block
          watir_element_call &block
          sleep 1
        end          
      end    
    end
    

    Also note, that Monkey Patching is generally a bad idea, and when I change the implementation (which I plan to), this code will break.

提交回复
热议问题