Sha256: ca84326d681ba97d638da5f1f1f3e3fb7f640204fc78a5d1b6986f77e9cf0774
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true module Aranha module Selenium class Session < ::SimpleDelegator module Wait WAIT_DEFAULT_TIMEOUT = 15 def wait(timeout = nil) timeout ||= wait_default_timeout ::Selenium::WebDriver::Wait.new(timeout: timeout) end def wait_default_timeout WAIT_DEFAULT_TIMEOUT end def wait_for_click(find_element_args, timeout = nil) wait(timeout).until do element = find_element(find_element_args) element ? element_click(element) : nil end end def wait_for_element(find_element_args) wait.until { find_element(find_element_args) } end def wait_for_download initial_downloads = downloads.current yield new_downloads = [] wait.until do new_downloads = downloads.current - initial_downloads new_downloads.any? end new_downloads.first end def wait_for_url_change(&block) previous_url = current_url block&.call wait.until { current_url != previous_url } end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aranha-selenium-0.6.0 | lib/aranha/selenium/session/wait.rb |