Benjie Sejas
Benjie Sejas

Reputation: 13

Is there any "after" page loaded hook for capybara+rspec

I am using capybara and rspec for my test automation and have search for how to assert if text exist in the page every time a new page loaded.

Example. Visit Home page
Assert "Benjie" is in page
Click link
wait for page to load
Assert "Benjie" is in page

Is there anyway I can do that without typing each assert manually?

Upvotes: 0

Views: 348

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49910

No, Capybara doesn't have a hook to run code after every page change. In fact, Capybara doesn't actually know when the page changes other than when you call visit. Every other behavior is assumed to be asynchronous.

Upvotes: 1

Related Questions