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
32 33 34 35 36 37 38 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 32 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
16 17 18 19 20 21 22 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 16 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
40 41 42 43 44 45 46 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 40 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
4 5 6 7 8 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 4 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
10 11 12 13 14 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 10 def find_elements_without_no_element_error(*args) find_elements(*args) rescue Selenium::WebDriver::Error::NoSuchElementError nil end |
#xpath(path, wait: nil) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/fe_core_ext/gem_ext/selenium_webdriver.rb', line 24 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 |