scrapy模擬點擊

lua_click = '''
function main(splash, args)
assert(splash:go(args.url))
assert(splash:wait(0.5))
local form = splash:select('#buttonId')
form:click()
splash:wait(2)
return {
    html = splash:html(),
    png = splash:png(),
    har = splash:har(),
}
end
'''



# 使用方式如下
yield SplashRequest(url
                    , self.parse
                    , endpoint='execute'
                    , args={'wait': '2',
                            # 'proxy': 'http://175.155.140.147:43305',
                            'timeout': '15',
                            'lua_source': self.lua_click}
                    )

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章