Scrapy Splash mouse_click无法返回正确的页面html

时间:2018-10-05 16:09:54

标签: python scrapy

我正在学习飞溅,正在锻炼。我想通过单击https://www.iana.org/domains/reserved中的地址文本框来访问 https://www.example.com/ 。但是它不能返回iana.org html,而只能返回example.com html。我有以下lua代码:

lua_script = '''function main(splash, args)
  splash.private_mode_enabled = false
  local url = splash.args.url
  assert(splash:go(url))
  assert(splash:wait(2))
  local alinks = splash:select('body > div > p:nth-child(3)')
  local bounds = alinks:bounds()
  assert(alinks:mouse_click{x=bounds.width/2, y=bounds.height/2})
  assert(splash:wait(2))
  return {
    tml = splash:html(),
  }
end
'''

0 个答案:

没有答案