Sha256: 79945408b9e553c5d98c18af500e0f4ead34b77ade7c19c0da229afeceab840e

Contents?: true

Size: 1.41 KB

Versions: 8

Compression:

Stored size: 1.41 KB

Contents

module Appium::Capybara
  class Appium::Capybara::Node < Capybara::Driver::Node
    def [](name)
      native.attribute(name.to_s)
    rescue Selenium::WebDriver::Error::WebDriverError
      nil
    end

    def value
      native.value
    end

    def label
      native.label
    end

    def name
      native.name
    end

    def set(value)
      native.clear
      send_keys(value)
    end

    def send_keys(value)
      native.send_keys(value.to_s)
    end

    def click
      native.click
    end

    def long_press
      action = Appium::TouchAction.new
      action.long_press(element: native, duration: 2000)
      action.perform
    end

    def tag_name
      native.tag_name
    end

    def visible?
      displayed = native.displayed?
      displayed && displayed != "false"
    end

    def selected?
      selected = native.selected?
      selected && selected != "false"
    end

    def disabled?
      !native.enabled?
    end

    def find_xpath(locator)
      native.find_elements(:xpath, locator).map { |n| self.class.new(driver, n) }
    end

    def find_css(locator)
      native.find_elements(:css, locator).map { |n| self.class.new(driver, n) }
    end

    def find_custom(finder, locator)
      native.find_elements(finder, locator).map { |n| self.class.new(driver, n) }
    end

    def ==(other)
      native == other.native
    end

    def inspect
      %(#<#{self.class} name="#{name}">)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
appium_capybara-1.0.0 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.1.2 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.1.1 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.1.0 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.0.4 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.0.3 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.0.2 lib/appium_capybara/driver/appium/node.rb
appium_capybara-0.0.1 lib/appium_capybara/driver/appium/node.rb