Skip to content

Commit 2eca943

Browse files
authored
Merge pull request #1945 from emanlove/remove-deprecated-is_string
Remove deprecated is string
2 parents 5a9000a + e361743 commit 2eca943

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

src/SeleniumLibrary/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
from robot.api import logger
2525
from robot.errors import DataError
2626
from robot.libraries.BuiltIn import BuiltIn
27-
from robot.utils import is_string
2827
from robot.utils.importer import Importer
2928

3029
from robotlibcore import DynamicCore
@@ -843,7 +842,7 @@ def _store_plugin_keywords(self, plugin):
843842

844843
def _resolve_screenshot_root_directory(self):
845844
screenshot_root_directory = self.screenshot_root_directory
846-
if is_string(screenshot_root_directory):
845+
if isinstance(screenshot_root_directory, str):
847846
if screenshot_root_directory.upper() == EMBED:
848847
self.screenshot_root_directory = EMBED
849848
if screenshot_root_directory.upper() == BASE64:

src/SeleniumLibrary/keywords/window.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from SeleniumLibrary.base import keyword, LibraryComponent
2323
from SeleniumLibrary.locators import WindowManager
24-
from SeleniumLibrary.utils import plural_or_not, is_string
24+
from SeleniumLibrary.utils import plural_or_not
2525

2626

2727
class WindowKeywords(LibraryComponent):
@@ -117,7 +117,7 @@ def switch_window(
117117
except NoSuchWindowException:
118118
pass
119119
finally:
120-
if not is_string(browser) or not browser.upper() == "CURRENT":
120+
if not isinstance(browser, str) or not browser.upper() == "CURRENT":
121121
self.drivers.switch(browser)
122122
self._window_manager.select(locator, timeout)
123123

src/SeleniumLibrary/locators/windowmanager.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
from SeleniumLibrary.base import ContextAware
2323
from SeleniumLibrary.errors import WindowNotFound
24-
from SeleniumLibrary.utils import is_string
2524

2625

2726
WindowInfo = namedtuple("WindowInfo", "handle, id, name, title, url")
@@ -38,15 +37,15 @@ def __init__(self, ctx):
3837
}
3938

4039
def get_window_handles(self, browser):
41-
if is_string(browser) and browser == "ALL":
40+
if isinstance(browser, str) and browser == "ALL":
4241
handles = []
4342
current_index = self.drivers.current_index
4443
for index, driver in enumerate(self.drivers, 1):
4544
self.drivers.switch(index)
4645
handles.extend(self.driver.window_handles)
4746
self.drivers.switch(current_index)
4847
return handles
49-
elif is_string(browser) and browser == "CURRENT":
48+
elif isinstance(browser, str) and browser == "CURRENT":
5049
return self.driver.window_handles
5150
else:
5251
current_index = self.drivers.current_index
@@ -60,14 +59,14 @@ def get_window_infos(self, browser="CURRENT"):
6059
current_index = self.drivers.current_index
6160
except AttributeError:
6261
current_index = None
63-
if is_string(browser) and browser.upper() == "ALL":
62+
if isinstance(browser, str) and browser.upper() == "ALL":
6463
infos = []
6564
for index, driver in enumerate(self.drivers, 1):
6665
self.drivers.switch(index)
6766
infos.extend(self._get_window_infos())
6867
self.drivers.switch(current_index)
6968
return infos
70-
elif is_string(browser) and browser.upper() == "CURRENT":
69+
elif isinstance(browser, str) and browser.upper() == "CURRENT":
7170
return self._get_window_infos()
7271
else:
7372
self.drivers.switch(browser)
@@ -100,7 +99,7 @@ def select(self, locator, timeout=0):
10099
time.sleep(0.1)
101100

102101
def _select(self, locator):
103-
if not is_string(locator):
102+
if not isinstance(locator, str):
104103
self._select_by_excludes(locator)
105104
elif locator.upper() == "CURRENT":
106105
pass

src/SeleniumLibrary/utils/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
from .types import (
2121
is_falsy,
2222
is_noney,
23-
is_string,
2423
is_truthy,
2524
WINDOWS,
2625
_convert_timeout,

src/SeleniumLibrary/utils/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from datetime import timedelta
1818
from typing import Any
1919

20-
from robot.utils import is_string, timestr_to_secs
20+
from robot.utils import timestr_to_secs
2121
from robot.utils import is_truthy, is_falsy # noqa
2222

2323
# Need only for unit tests and can be removed when Approval tests fixes:
@@ -26,7 +26,7 @@
2626

2727

2828
def is_noney(item):
29-
return item is None or is_string(item) and item.upper() == "NONE"
29+
return item is None or isinstance(item, str) and item.upper() == "NONE"
3030

3131
def _convert_delay(delay):
3232
if isinstance(delay, timedelta):

utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ SeleniumLibrary can be imported with several optional arguments.
77
- ``run_on_failure``:
88
Default action for the `run-on-failure functionality`.
99
- ``screenshot_root_directory``:
10-
Path to folder where possible screenshots are created or EMBED.
11-
See `Set Screenshot Directory` keyword for further details about EMBED.
10+
Path to folder where possible screenshots are created or EMBED or BASE64.
11+
See `Set Screenshot Directory` keyword for further details about EMBED and BASE64.
1212
If not given, the directory where the log file is written is used.
1313
- ``plugins``:
1414
Allows extending the SeleniumLibrary with external Python classes.

0 commit comments

Comments
 (0)