简体   繁体   中英

“Listening” to AJAX calls from Capybara / Selenium - Rails

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM