2

I have an app which makes AJAX calls on certain events (e.g. .click). Is there a way to "listen" to real AJAX requests from feature specswith Capybara / Selenium?

I tried the Teaspoon gem, but apparently its only allowing accessing fixture URLs (as per this SO).

Community
  • 1
  • 1
dimitry_n
  • 2,939
  • 1
  • 30
  • 53

1 Answers1

2

No you can't listen to events in the browser from Capybara, you can only look for changes that occur as a result of those events. ie. If clicking a button makes an ajax request and then changes part of the page, check for the element that is added/removed from the page.

Thomas Walpole
  • 48,548
  • 5
  • 64
  • 78