Sha256: 6fb0cfb37aa7f6fb4738c8016cc57242862a132d29bc963d26259f85fe2be0ee

Contents?: true

Size: 1.14 KB

Versions: 1

Compression:

Stored size: 1.14 KB

Contents

class Selenium::WebDriver::Driver
  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.33 lib/fe_core_ext/gem_ext/selenium_webdriver.rb