I want to select the "2nd-page" button at the end of this website using Splash code (Docker/Browser ver).
I even used the "copy Selector" function of Chrome to get to the extract part, I also checked with F12 and CtrlF and found the extract position. But somehow my code still fail at the select
function
Below is my simple Lua Splash code:
function main(splash, args)
splash.private_mode_enabled = false
url = args.url
assert(splash:go(url))
assert(splash:wait(1))
next_page = assert(splash:select('div > div.py20 > div > nav > ul > li:nth-child(3) > a'))
assert(splash:wait(1))
next_page:mouse_click()
return {splash:html()}
end
My code always fails at the next_page
line with an assertion error:
{
"error": 400,
"type": "ScriptError",
"description": "Error happened while executing Lua script",
"info": {
"source": "[string \"function main(splash, args)\r...\"]",
"line_number": 8,
"error": "assertion failed!",
"type": "LUA_ERROR",
"message": "Lua error: [string \"function main(splash, args)\r...\"]:8: assertion failed!"
}
}