How to intercept a XHR request to return a mock json list

I like to implement VIEW test. My application is Java Playframework. My main page shows a list of stores. When you come to the main page, a XHR request is fired by Javascript and hits one of my rountes. The controller returns a list of stores in Json and a list of stores is finally populated in DOM.

What I like to do is to intercept a XHR request and return a mock response that contains a static list of Stores. So that when I sort a list or filter a list, I can easily test by selenium.

My current problems are:

  1. I am using TestBrowser. I can only see the html elements found in my scala.html. I cannot see the dynamically created html/dom
  2. How do I intercept a XHR request and return a mock response that will be used to generate a list of Store dynamically?

I appreciate if someone guides me to somewhere from where I am.