Skip to content

Commit

Permalink
Merge pull request #1741 from iongroup/feat/minimize
Browse files Browse the repository at this point in the history
Added minimize keyword
  • Loading branch information
emanlove authored Nov 25, 2023
2 parents 6c77370 + 04b202c commit 82fbe22
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
24 changes: 24 additions & 0 deletions atest/acceptance/windows.robot
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,30 @@ Set Window Position using strings
Should Be Equal ${x} ${200}
Should Be Equal ${y} ${100}

Test Minimize and Maximize Will Actually Move and Resize Window
Set Window Position 300 200
Set Window Size 400 300
${isHidden}= Execute Javascript return document.hidden;
Should Not Be True ${isHidden}

Minimize Browser Window

${isHidden}= Execute Javascript return document.hidden;
Should Be True ${isHidden}

Maximize Browser Window

${isHidden}= Execute Javascript return document.hidden;
Should Not Be True ${isHidden}

${x} ${y}= Get Window Position
${width} ${height}= Get Window Size
# Windows: Can't test for zero in multi-monitor setups
Should Not Be Equal ${x} ${300}
Should Not Be Equal ${y} ${200}
Should Be True ${width} > 400
Should Be True ${height} > 300

Select Window By Title After Close Window
[Tags] Known Issue Internet Explorer Known Issue Safari
Cannot Be Executed in IE
Expand Down
5 changes: 5 additions & 0 deletions src/SeleniumLibrary/keywords/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def maximize_browser_window(self):
"""Maximizes current browser window."""
self.driver.maximize_window()

@keyword
def minimize_browser_window(self):
"""Minimizes current browser window."""
self.driver.minimize_window()

@keyword
def get_window_size(self, inner: bool = False) -> Tuple[float, float]:
"""Returns current window width and height as integers.
Expand Down
2 changes: 1 addition & 1 deletion utest/test/api/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def setUpClass(cls):
def test_no_libraries(self):
for item in [None, "None", ""]:
sl = SeleniumLibrary(plugins=item)
self.assertEqual(len(sl.get_keyword_names()), 177)
self.assertEqual(len(sl.get_keyword_names()), 178)

def test_parse_library(self):
plugin = "path.to.MyLibrary"
Expand Down

0 comments on commit 82fbe22

Please sign in to comment.