Sha256: 901262db05125b0787b59f65d7244345850d1c6c5bfdae286aa39359b4c7eb09
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
require 'selenium-webdriver' class GogoDriver class Entity attr_accessor :driver def initialize @driver = Selenium::WebDriver.for(:chrome) end def go(url) @driver.navigate.to(url) end def reload @driver.navigate.refresh end def find(selector) @driver.find_element(css: selector) end def finds(selector) @driver.find_elements(css: selector) end def has?(selector) !!find(selector) rescue Selenium::WebDriver::Error::NoSuchElementError false end def has_text?(text) !!@driver.find_element({xpath: "//*[text()[contains(.,\"#{text}\")]]"}) rescue Selenium::WebDriver::Error::NoSuchElementError false end def click(selector) has?(selector) ? find(selector).click : false end def submit $focus.submit if $focus end end end class Selenium::WebDriver::Element def fill(text) $focus = self send_key(text) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
gogo_driver-0.0.5 | lib/gogo_driver/entity.rb |