Google Chrome extension load page in background and wait

So everyone here knows those downloadsites where you have to wait a certain amount of time before the download link appears. I have a similar website that changes after a certain amount of time and I need something from that website after that time. But I have no idea how to do this, I tried it using an iframe element. But I’m stuck since I can’t even check when the content has been loaded. The innerHTML is undefined for some reason. Mutliple tips and tricks led to nothing or even worse than the code I already had. So does someone know how to load a page, wait and check whether a certain div is on the page. If not, repeat.

This is the code I tried using an iframe element, but it leads to nothing. I’m using jQuery, but I also tried vanilla Javascript.

var iframe = document.createElement('iframe'),
	iframeWindow;
iframe.src = scrapUrl;
document.body.appendChild(iframe);
iframeWindow = iframe.contentWindow || iframe;
iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
iframe.onload = function() {
	alert('The iFrame has loaded.');
	alert(iframeWindow);
};

(scrapUrl is defined above this, all of the above code has no effect on this part of the code so you don’t need to worry about that code)