Class: Webdriver::Window
- Inherits:
-
Object
- Object
- Webdriver::Window
- Defined in:
- lib/webdriver/window.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #close! ⇒ Object
- #fullscreen! ⇒ Object
-
#initialize(id, connection) ⇒ Window
constructor
A new instance of Window.
- #maximize! ⇒ Object
- #minimize! ⇒ Object
- #position ⇒ Object
- #position!(opts) ⇒ Object
- #rect ⇒ Object
- #rect!(width: nil, height: nil, x: nil, y: nil) ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(id, connection) ⇒ Window
Returns a new instance of Window.
4 5 6 7 8 |
# File 'lib/webdriver/window.rb', line 4 def initialize(id, connection) @id = id @session_connection = connection @connection = Webdriver::PrefixConnection.new "window/#{@id}", connection end |
Instance Attribute Details
#id ⇒ Object (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
51 52 53 54 |
# File 'lib/webdriver/window.rb', line 51 def close! @connection.delete self end |
#fullscreen! ⇒ Object
46 47 48 49 |
# File 'lib/webdriver/window.rb', line 46 def fullscreen! @connection.post "fullscreen" self end |
#maximize! ⇒ Object
22 23 24 25 |
# File 'lib/webdriver/window.rb', line 22 def maximize! @connection.post "maximize" self end |
#minimize! ⇒ Object
27 28 29 30 |
# File 'lib/webdriver/window.rb', line 27 def minimize! @session_connection.post "window/minimize" self end |
#position ⇒ Object
14 15 16 |
# File 'lib/webdriver/window.rb', line 14 def position @connection.get "position" end |
#position!(opts) ⇒ Object
18 19 20 |
# File 'lib/webdriver/window.rb', line 18 def position! opts @connection.post "position", {}, opts end |
#rect ⇒ Object
42 43 44 |
# File 'lib/webdriver/window.rb', line 42 def rect @session_connection.get "window/rect" end |
#rect!(width: nil, height: nil, x: nil, y: nil) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/webdriver/window.rb', line 32 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 |
#size ⇒ Object
10 11 12 |
# File 'lib/webdriver/window.rb', line 10 def size @connection.get "size" end |