Class: Webdriver::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/webdriver/window.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, connection) ⇒ Window

Returns a new instance of Window.



4
5
6
7
# File 'lib/webdriver/window.rb', line 4

def initialize(id, connection)
  @id = id
  @connection = Webdriver::PrefixConnection.new "window", connection
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/webdriver/window.rb', line 3

def id
  @id
end

Instance Method Details

#close!Object



38
39
40
41
# File 'lib/webdriver/window.rb', line 38

def close!
  @connection.delete
  self
end

#fullscreen!Object



33
34
35
36
# File 'lib/webdriver/window.rb', line 33

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

#maximize!Object



9
10
11
12
# File 'lib/webdriver/window.rb', line 9

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

#minimize!Object



14
15
16
17
# File 'lib/webdriver/window.rb', line 14

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

#rectObject



29
30
31
# File 'lib/webdriver/window.rb', line 29

def rect
  @connection.get "rect"
end

#rect!(width: nil, height: nil, x: nil, y: nil) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/webdriver/window.rb', line 19

def rect! width: nil, height: nil, x: nil, y:nil
  @connection.post("rect", {}, {
    width: width,
    height: height,
    x: x,
    y: y
  })
  self
end