Sha256: 62212951c9aea6e18dffd0126f1181a7bd6b5033dacf55943461d596e2264070

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

module Selenium::WebDriver::Find
  def fe_find_element(*args)
    find_element(*args)
  rescue Selenium::WebDriver::Error::NoSuchElementError
    nil
  end

  def fe_find_elements(*args)
    find_elements(*args)
  rescue Selenium::WebDriver::Error::NoSuchElementError
    nil
  end

  def at_xpath(path, wait: nil)
    if wait.present?
      driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
      driver_wait.until { fe_find_element(:xpath, path) }
    end
    fe_find_element(:xpath, path)
  end

  def xpath(path, wait: nil)
    if wait.present?
      driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
      driver_wait.until { fe_find_elements(:xpath, path) }
    end
    fe_find_elements(:xpath, path)
  end

  def at_css(path, wait: nil)
    if wait.present?
      driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
      driver_wait.until { fe_find_element(:css, path) }
    end
    fe_find_element(:css, path)
  end

  def css(path, wait: nil)
    if wait.present?
      driver_wait = Selenium::WebDriver::Wait.new(timeout: wait)
      driver_wait.until { fe_find_elements(:css, path) }
    end
    fe_find_elements(:css, path)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe_core_ext-0.1.34 lib/fe_core_ext/gem_ext/selenium_webdriver.rb