Module: Async::WebDriver::Scope::Window
- Included in:
- Async::WebDriver::Session
- Defined in:
- lib/async/webdriver/scope/window.rb
Overview
Helpers for managing the browser window size and position.
Instance Method Summary collapse
-
#fullscreen_window ⇒ Object
Make the browser window fullscreen.
-
#maximize_window ⇒ Object
Maximize the browser window.
-
#minimize_window ⇒ Object
Minimize the browser window.
-
#resize_window(width, height) ⇒ Object
Resize the browser window to the given dimensions.
-
#set_window_rect(x: nil, y: nil, width: nil, height: nil) ⇒ Object
Set the window rect (position and/or size).
-
#window_rect ⇒ Object
Get the current window rect (position and size).
Instance Method Details
#fullscreen_window ⇒ Object
Make the browser window fullscreen.
44 45 46 |
# File 'lib/async/webdriver/scope/window.rb', line 44 def fullscreen_window session.post("window/fullscreen") end |
#maximize_window ⇒ Object
Maximize the browser window.
34 35 36 |
# File 'lib/async/webdriver/scope/window.rb', line 34 def maximize_window session.post("window/maximize") end |
#minimize_window ⇒ Object
Minimize the browser window.
39 40 41 |
# File 'lib/async/webdriver/scope/window.rb', line 39 def minimize_window session.post("window/minimize") end |
#resize_window(width, height) ⇒ Object
Resize the browser window to the given dimensions.
29 30 31 |
# File 'lib/async/webdriver/scope/window.rb', line 29 def resize_window(width, height) set_window_rect(width: width, height: height) end |
#set_window_rect(x: nil, y: nil, width: nil, height: nil) ⇒ Object
Set the window rect (position and/or size).
22 23 24 |
# File 'lib/async/webdriver/scope/window.rb', line 22 def set_window_rect(x: nil, y: nil, width: nil, height: nil) session.post("window/rect", {x: x, y: y, width: width, height: height}.compact) end |
#window_rect ⇒ Object
Get the current window rect (position and size).
13 14 15 |
# File 'lib/async/webdriver/scope/window.rb', line 13 def window_rect session.get("window/rect") end |