I want to use Python and Splash to select the 'Ich stimme zu' button with XPATH and then click.
I can't use the CSS class because it has a dynamic name.
Can someone help me here please?
function main(splash)
local url = splash.args.url
assert(splash:go(url))
assert(splash:wait(0.5))
bounds = selector:xpath("/html/body/c-wiz/div/div/div/div[2]/div[1]/div[4]/form/div/div").click()
return {
html = splash:html(),
png = splash:png(),
href=href,
}
end
It turns out that I can click on the button absolutely fine with CSS - I have tested it on the console.
It seems you're trying to integrate the script with
scrapy-splash, turns out that the message you get does not appear on the splash console.Perhaps you were trying it and there was no button because you did not realise this?Anyways - here's what worked for me in the console, I have updated it within the lua script: