Sha256: 2fe73f5bd959300cbb9ee347728c2f906a304b0c99fd2dea4f6066d23f688418

Contents?: true

Size: 992 Bytes

Versions: 10

Compression:

Stored size: 992 Bytes

Contents

module Webdriver
  class Window
    attr_reader :id
    def initialize(id, connection)
      @id = id
      @session_connection = connection
      @connection = Webdriver::PrefixConnection.new "window/#{@id}", connection
    end

    def size
      @connection.get "size"
    end

    def position
      @connection.get "position"
    end

    def position! opts
      @connection.post "position", {}, opts
    end

    def maximize!
      @connection.post "maximize"
      self
    end

    def minimize!
      @session_connection.post "window/minimize"
      self
    end

    def rect! width: nil, height: nil, x: nil, y:nil
      @session_connection.post "window/rect", {}, {
        width: width,
        height: height,
        x: x,
        y: y
      }
      self
    end

    def rect
      @session_connection.get "window/rect"
    end

    def fullscreen!
      @connection.post "fullscreen"
      self
    end

    def close!
      @connection.delete
      self
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
webdriver-0.19.0 lib/webdriver/window.rb
webdriver-0.18.0 lib/webdriver/window.rb
webdriver-0.17.0 lib/webdriver/window.rb
webdriver-0.16.0 lib/webdriver/window.rb
webdriver-0.15.0 lib/webdriver/window.rb
webdriver-0.14.0 lib/webdriver/window.rb
webdriver-0.13.0 lib/webdriver/window.rb
webdriver-0.12.0 lib/webdriver/window.rb
webdriver-0.11.1 lib/webdriver/window.rb
webdriver-0.11.0 lib/webdriver/window.rb