Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a helper function to wait for element #569

Open
kmike opened this issue Feb 21, 2017 · 2 comments
Open

add a helper function to wait for element #569

kmike opened this issue Feb 21, 2017 · 2 comments

Comments

@kmike
Copy link
Member

kmike commented Feb 21, 2017

Something like splash:wait_for_element(css_selector, timeout, poll_interval).

It should do something like this (untested):

function Splash:wait_for_element(css, timeout, poll_interval)
  return splash:with_timeout(function()
    while not splash:select(css) do
      splash:wait(poll_interval)
    end
  end, timeout)
end
@dalepo
Copy link

dalepo commented May 3, 2018

Hey @kmike I did a similar method here but gave me high cpu usage. I will be testing this one out

Edit: Definitely worked fine in my production scripts

@maxwill-max
Copy link

with_timeout runs even after selecting the css, stops only when timeout is met

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants