Sha256: 4ef828a8af412e222860d84cc4e95f8e8df90ddd5bfa1e9d7b53ced27262ecde

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

module Webdriver
  class Session
    attr_reader :id

    def initialize(json, connection)
      @id = json.dig "id"
      @connection = Webdriver::PrefixConnection.new "session/#{@id}", connection
    end

    def delete!
      @connection.delete
    end

    def windows
      value = @connection.get "window/handles"
      value.map { |id| Webdriver::Window.new id, @connection }
    end

    def url! url
      @connection.post "url", {}, {
        url: url
      }
    end

    def url
      @connection.get "url"
    end

    def back!
      @connection.post "back"
    end

    def forward!
      @connection.post "forward"
    end

    def refresh!
      @connection.post "refresh"
    end

    def title
      @connection.get "title"
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
webdriver-0.2.0 lib/webdriver/session.rb