How to get popup content with splash
<p>i'm starting to use scrapy with splash, and i was wondering if splash can handle multiple windows and popups. As an example i would like to use that lua script and try to obtain the google window's content</p>

<pre><code>function main(splash)
  assert(splash:go("http://stackoverflow.com/"))
  assert(splash:runjs("window.open('http://www.google.com');"))
  assert(splash:wait(5))
  return {
    ?
  }
end
</code></pre>

<p>I've found a tiny hack, i do a</p>

<pre><code>assert(splash:runjs("window.open = function(url) {window.location.replace(url)};")
</code></pre>

<p>So instead of opening new windows, you are redirected towards the link, however it's a hack and it might not work if window.open is not used to open the popup</p>

<p>I think scrapy with selenium could be a solution too but i want to keep my stuff lightweight</p>

python web-scraping popup scrapy scrapy-splash