Skip to content

Commit 2388e65

Browse files
committed
- Added minimize keyword
- Added atest
1 parent 7769ed6 commit 2388e65

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

atest/acceptance/windows.robot

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,30 @@ Set Window Position using strings
108108
Should Be Equal ${x} ${200}
109109
Should Be Equal ${y} ${100}
110110

111+
Test Minimize and Maximize Will Actually Move and Resize Window
112+
Set Window Position 300 200
113+
Set Window Size 400 300
114+
${isHidden}= Execute Javascript return document.hidden;
115+
Should Not Be True ${isHidden}
116+
117+
Minimize Browser Window
118+
119+
${isHidden}= Execute Javascript return document.hidden;
120+
Should Be True ${isHidden}
121+
122+
Maximize Browser Window
123+
124+
${isHidden}= Execute Javascript return document.hidden;
125+
Should Not Be True ${isHidden}
126+
127+
${x} ${y}= Get Window Position
128+
${width} ${height}= Get Window Size
129+
# Windows: Can't test for zero in multi-monitor setups
130+
Should Not Be Equal ${x} ${300}
131+
Should Not Be Equal ${y} ${200}
132+
Should Be True ${width} > 400
133+
Should Be True ${height} > 300
134+
111135
Select Window By Title After Close Window
112136
[Tags] Known Issue Internet Explorer Known Issue Safari
113137
Cannot Be Executed in IE

src/SeleniumLibrary/keywords/window.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ def maximize_browser_window(self):
186186
"""Maximizes current browser window."""
187187
self.driver.maximize_window()
188188

189+
@keyword
190+
def minimize_browser_window(self):
191+
"""Minimizes current browser window."""
192+
self.driver.minimize_window()
193+
189194
@keyword
190195
def get_window_size(self, inner: bool = False) -> Tuple[float, float]:
191196
"""Returns current window width and height as integers.

0 commit comments

Comments
 (0)