Search code examples
seleniumcucumberselenium-webdriverweb-testing

Cucumber, a method that will be called always? Selenium-webdriver.


I am writing tests using selenium webdriver with cucumber. The web page is very much ajax-based. What I want to do is, whenever cucumber calls a method, it should call someother method ALWAYS.

So say in my feature file I have:

When I say hello

which calls method

sayHello()

after this I want

waitForAjax()

to be called.

How can I do this?


Solution

  • If you want to invoke that method after each Cucumber step, you can use AfterStep hook:

    AfterStep do |scenario|
      # Do something after each step.
    end