Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added minimize keyword #1741

Merged
merged 3 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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