Open Mifrill opened 2 years ago
Can this be merged? Do the linters need to be changed or do we want to follow the linter advice?
Hello @dsisnero this PR is on review, it can't be merged without approval. The linter offenses are not related to this particular PR, we have dedicated PR to solve it: https://github.com/rubycdp/ferrum/pull/237 that also on review.
I'm sorry guys, with all this stuff happening I barely find time for open source now, hope it's going to calm down soon.
If anyone needs a simple substitute of assert_selector
or Selenium::WebDriver::Wait.new.until &block
and google leads him here, here is a simple ruby snippet to wait for arbitrary things to return true
:
timeout_true = lambda do |timeout = 1, &block|
Timeout.timeout timeout do
block.yield or (sleep 0.1; redo)
end
end
Any chance we could have a reviewer review and accept this? It would be very nice to have in the main Gem.
Thanks!
Would this be simpler?
class Ferrum::Browser
def wait_for(want, wait:1, step:0.1)
meth = want.start_with?('/') ? :at_xpath : :at_css
until node = send(meth, want)
(wait -= step) > 0 ? sleep(step) : break
end
node
end
end
closes #82