3

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

function main(splash)
  assert(splash:go("http://stackoverflow.com/"))
  assert(splash:runjs("window.open('http://www.google.com');"))
  assert(splash:wait(5))
  return {
    ?
  }
end
Gallaecio
  • 3,620
  • 2
  • 25
  • 64
Arnaud PARAN
  • 126
  • 5

1 Answers1

2

I've found a tiny hack, i do a

assert(splash:runjs("window.open = function(url) {window.location.replace(url)};")

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

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

Arnaud PARAN
  • 126
  • 5