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(&block) ⇒ Object
- #skip_trophies ⇒ Object
- #skip_trophy_overlay? ⇒ Boolean
Instance Method Details
#on_rescue_timeout(&block) ⇒ Selenium::WebDriver::Error::TimeoutError?
15 16 17 18 19 20 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 15 def on_rescue_timeout(&block) block.call nil rescue ::Selenium::WebDriver::Error::TimeoutError => e e end |
#on_skip_trophies(&block) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 22 def on_skip_trophies(&block) error = on_rescue_timeout(&block) return unless error raise error unless skip_trophies end |
#skip_trophies ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 30 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
39 40 41 |
# File 'lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb', line 39 def find_or_not_element(xpath: TROPHY_SKIP_BUTTON_XPATH).present? end |