scrapinghub / splash

Lightweight, scriptable browser as a service with an HTTP API
BSD 3-Clause "New" or "Revised" License
4.04k stars 508 forks source link

splash:with_timeout should also exit as soon as condition is met #1101

Open maxwill-max opened 3 years ago

maxwill-max commented 3 years ago

function wait_for_element(splash,css,timeout,poll_interval) if timeout == nil then timeout = 10 end poll_interval=0.5 return splash:with_timeout ( function() while not splash:select(css) do assert(splash:wait(poll_interval)) end end, timeout) end

the function runs until it times out even though the condition is met within a few seconds