0

I'm writing a GreaseMonkey script that does the following things:

  1. While I am on URL_1, the script sends a "GET" XMLHttpRequest to download the HTML code of the web page at URL_2.

  2. The script then saves URL_2's HTML code into a variable and uses jQuery to find elements belonging to .CLASS in order to extract some text.

The issue is that the elements belonging to .CLASS load after the page at URL_2 loads. If I enter URL_2 into the address bar and load the page, the .CLASS elements eventually load. However, if I download the page via a "GET" request, the .CLASS elements are not in the HTML code that the request returns.

How can I get the HTML code of the .CLASS elements?

PS: If it helps, here is the URL_2 I mentioned: http://slader.com/search/?include=textbook_index&search_query=stewart. The first element with the class "results" is empty when the page loads. Its child nodes (the ones I'm trying to extract text from) load afterwards.

  • The site uses [algoliasearch](https://github.com/algolia/algoliasearch-client-javascript) to fetch the results as you can see in devtools network panel. I think it's possible to use the library directly (`@require` + grab the API key from the network panel request) but it might take a while... – wOxxOm Jan 14 '17 at 00:06
  • @wOxxOm brock-adams I had no idea you could view web page requests. I just checked and found the request with the data I was looking for. Many thanks for your response. – Oscar Shaw Jan 14 '17 at 00:41

0 Answers0