Module: EhbrsRubyUtils::Bga::Session::SkipTrophies
- Defined in:
- lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb
Constant Summary collapse
- TROPHY_SKIP_BUTTON_XPATH =
'//*[@id = "splashedNotifications_overlay"]' \ '//*[starts-with(@id, "continue_btn_")]'
- TROPHY_SKIP_TIMEOUT =
5
Instance Method Summary collapse
- #on_rescue_timeout(&block) ⇒ Selenium::WebDriver::Error::TimeoutError?
- #on_skip_trophies ⇒ Object
- #skip_trophies ⇒ Object
- #skip_trophy_overlay? ⇒ Boolean
Instance Method Details
#on_rescue_timeout(&block) ⇒ Selenium::WebDriver::Error::TimeoutError?
13 14 15 16 17 18 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 13 def on_rescue_timeout(&block) block.call nil rescue ::Selenium::WebDriver::Error::TimeoutError => e e end |
#on_skip_trophies ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 20 def on_skip_trophies(...) error = on_rescue_timeout(...) return unless error raise error unless skip_trophies end |
#skip_trophies ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 28 def skip_trophies loop do wait_for_click({ xpath: TROPHY_SKIP_BUTTON_XPATH }, TROPHY_SKIP_TIMEOUT) rescue ::Selenium::WebDriver::Error::TimeoutError break end end |
#skip_trophy_overlay? ⇒ Boolean
37 38 39 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 37 def find_or_not_element(xpath: TROPHY_SKIP_BUTTON_XPATH).present? end |