Skip to content

Commit c69f2cc

Browse files
authored
Removed deprecated window selectors (#1200)
Fixes 1187
1 parent 36da705 commit c69f2cc

File tree

3 files changed

+4
-36
lines changed

3 files changed

+4
-36
lines changed

src/SeleniumLibrary/keywords/window.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ def select_window(self, locator='MAIN', timeout=None):
9494
9595
- The ``strategy:value`` syntax is only supported by SeleniumLibrary
9696
3.0 and newer.
97-
- Earlier versions supported aliases ``None``, ``null`` and the
98-
empty string for selecting the main window, and alias ``self``
99-
for selecting the current window. These aliases were deprecated
100-
in SeleniumLibrary 3.0.
10197
- Prior to SeleniumLibrary 3.0 matching windows by name, title
10298
and URL was case-insensitive.
99+
- Earlier versions supported aliases ``None``, ``null`` and the
100+
empty string for selecting the main window, and alias ``self``
101+
for selecting the current window. Support for these aliases were
102+
removed in SeleniumLibrary 3.2.
103103
"""
104104
epoch = time.time()
105105
timeout = epoch if is_falsy(timeout) else timestr_to_secs(timeout) + epoch

src/SeleniumLibrary/locators/windowmanager.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,6 @@
3030

3131

3232
class WindowManager(ContextAware):
33-
_deprecated_locators = {
34-
None: 'main',
35-
'null': 'main',
36-
'': 'main',
37-
'popup': 'new',
38-
'self': 'current'
39-
}
4033

4134
def __init__(self, ctx):
4235
ContextAware.__init__(self, ctx)
@@ -63,7 +56,6 @@ def get_window_infos(self):
6356
return infos
6457

6558
def select(self, locator, timeout=0):
66-
locator = self._handle_deprecated_locators(locator)
6759
while True:
6860
try:
6961
return self._select(locator)
@@ -85,17 +77,6 @@ def _select(self, locator):
8577
strategy, locator = self._parse_locator(locator)
8678
self._strategies[strategy](locator)
8779

88-
def _handle_deprecated_locators(self, locator):
89-
if not (is_string(locator) or locator is None):
90-
return locator
91-
normalized = locator.lower() if is_string(locator) else locator
92-
if normalized in self._deprecated_locators:
93-
new = self._deprecated_locators[normalized]
94-
logger.warn("Using '%s' as window locator is deprecated. "
95-
"Use '%s' instead." % (locator, new))
96-
return new
97-
return locator
98-
9980
def _parse_locator(self, locator):
10081
index = self._get_locator_separator_index(locator)
10182
if index != -1:

utest/test/locators/test_windowmanager.py

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,6 @@ def test_select_by_url_no_match(self):
9999
"Unable to locate window with URL 'http://localhost/page-1.html'."
100100
)
101101

102-
def test_select_with_deprecated_locators_to_select_main_window(self):
103-
manager = WindowManagerWithMockBrowser(
104-
{'name': 'win1', 'title': "Title 1", 'url': 'http://localhost/page1.html'},
105-
{'name': 'win2', 'title': "Title 2", 'url': 'http://localhost/page2.html'},
106-
{'name': 'win3', 'title': "Title 3", 'url': 'http://localhost/page3.html'}
107-
)
108-
for deprecated in [None, 'null', 'NULL', '']:
109-
manager.select("name=win2")
110-
msg = "Using '%s' as window locator is deprecated. Use 'main' instead." % deprecated
111-
with when(logger).warn(msg).thenReturn(None):
112-
manager.select(deprecated)
113-
self.assertEqual(manager.driver.current_window.name, 'win1')
114-
115102
def test_select_main_window(self):
116103
manager = WindowManagerWithMockBrowser(
117104
{'name': 'win1', 'title': "Title 1", 'url': 'http://localhost/page1.html'},

0 commit comments

Comments
 (0)