Class: Selenium::WebDriver::Window
- Inherits:
-
Object
- Object
- Selenium::WebDriver::Window
- Defined in:
- lib/selenium/webdriver/common/window.rb
Instance Method Summary collapse
-
#initialize(bridge) ⇒ Window
constructor
private
A new instance of Window.
-
#maximize ⇒ Object
Maximize the current window.
-
#move_to(x, y) ⇒ Object
Equivalent to #position=, but accepts x and y arguments.
-
#position ⇒ Selenium::WebDriver::Point
Get the position of the current window.
-
#position=(point) ⇒ Object
Move the current window to the given position.
-
#resize_to(width, height) ⇒ Object
Equivalent to #size=, but accepts width and height arguments.
-
#size ⇒ Selenium::WebDriver::Dimension
Get the size of the current window.
-
#size=(dimension) ⇒ Object
Resize the current window to the given dimension.
Constructor Details
#initialize(bridge) ⇒ Window
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Window.
14 15 16 |
# File 'lib/selenium/webdriver/common/window.rb', line 14 def initialize(bridge) @bridge = bridge end |
Instance Method Details
#maximize ⇒ Object
Maximize the current window
97 98 99 |
# File 'lib/selenium/webdriver/common/window.rb', line 97 def maximize @bridge.maximizeWindow end |
#move_to(x, y) ⇒ Object
Equivalent to #position=, but accepts x and y arguments.
89 90 91 |
# File 'lib/selenium/webdriver/common/window.rb', line 89 def move_to(x, y) @bridge.setWindowPosition Integer(x), Integer(y) end |
#position ⇒ Selenium::WebDriver::Point
Get the position of the current window.
64 65 66 |
# File 'lib/selenium/webdriver/common/window.rb', line 64 def position @bridge.getWindowPosition end |
#position=(point) ⇒ Object
Move the current window to the given position.
49 50 51 52 53 54 55 56 |
# File 'lib/selenium/webdriver/common/window.rb', line 49 def position=(point) unless point.respond_to?(:x) && point.respond_to?(:y) raise ArgumentError, "expected #{point.inspect}:#{point.class}" + " to respond to #x and #y" end @bridge.setWindowPosition point.x, point.y end |
#resize_to(width, height) ⇒ Object
Equivalent to #size=, but accepts width and height arguments.
77 78 79 |
# File 'lib/selenium/webdriver/common/window.rb', line 77 def resize_to(width, height) @bridge.setWindowSize Integer(width), Integer(height) end |
#size ⇒ Selenium::WebDriver::Dimension
Get the size of the current window.
39 40 41 |
# File 'lib/selenium/webdriver/common/window.rb', line 39 def size @bridge.getWindowSize end |
#size=(dimension) ⇒ Object
Resize the current window to the given dimension.
24 25 26 27 28 29 30 31 |
# File 'lib/selenium/webdriver/common/window.rb', line 24 def size=(dimension) unless dimension.respond_to?(:width) && dimension.respond_to?(:height) raise ArgumentError, "expected #{dimension.inspect}:#{dimension.class}" + " to respond to #width and #height" end @bridge.setWindowSize dimension.width, dimension.height end |