Module: Selenium::WebDriver::Find
Instance Method Summary collapse
- #at_css(path, wait: nil) ⇒ Object
- #at_xpath(path, wait: nil) ⇒ Object
- #css(path, wait: nil) ⇒ Object
- #find_element_without_no_element_error(*args) ⇒ Object
- #find_elements_without_no_element_error(*args) ⇒ Object
- #xpath(path, wait: nil) ⇒ Object
Instance Method Details
#at_css(path, wait: nil) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 30 def at_css(path, wait: nil) if wait.present? driver_wait = Selenium::WebDriver::Wait.new(timeout: wait) driver_wait.until { find_element_without_no_element_error(:css, path) } end find_element_without_no_element_error(:css, path) end |
#at_xpath(path, wait: nil) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 14 def at_xpath(path, wait: nil) if wait.present? driver_wait = Selenium::WebDriver::Wait.new(timeout: wait) driver_wait.until { find_element_without_no_element_error(:xpath, path) } end find_element_without_no_element_error(:xpath, path) end |
#css(path, wait: nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 38 def css(path, wait: nil) if wait.present? driver_wait = Selenium::WebDriver::Wait.new(timeout: wait) driver_wait.until { find_elements_without_no_element_error(:css, path) } end find_elements_without_no_element_error(:css, path) end |
#find_element_without_no_element_error(*args) ⇒ Object
2 3 4 5 6 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 2 def find_element_without_no_element_error(*args) find_element(*args) rescue Selenium::WebDriver::Error::NoSuchElementError nil end |
#find_elements_without_no_element_error(*args) ⇒ Object
8 9 10 11 12 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 8 def find_elements_without_no_element_error(*args) find_elements(*args) rescue Selenium::WebDriver::Error::NoSuchElementError nil end |
#xpath(path, wait: nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 22 def xpath(path, wait: nil) if wait.present? driver_wait = Selenium::WebDriver::Wait.new(timeout: wait) driver_wait.until { find_elements_without_no_element_error(:xpath, path) } end find_elements_without_no_element_error(:xpath, path) end |