Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/SeleniumLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
from robot.api import logger
from robot.errors import DataError
from robot.libraries.BuiltIn import BuiltIn
from robot.utils import is_string
from robot.utils.importer import Importer

from robotlibcore import DynamicCore
Expand Down Expand Up @@ -843,7 +842,7 @@ def _store_plugin_keywords(self, plugin):

def _resolve_screenshot_root_directory(self):
screenshot_root_directory = self.screenshot_root_directory
if is_string(screenshot_root_directory):
if isinstance(screenshot_root_directory, str):
if screenshot_root_directory.upper() == EMBED:
self.screenshot_root_directory = EMBED
if screenshot_root_directory.upper() == BASE64:
Expand Down
4 changes: 2 additions & 2 deletions src/SeleniumLibrary/keywords/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from SeleniumLibrary.base import keyword, LibraryComponent
from SeleniumLibrary.locators import WindowManager
from SeleniumLibrary.utils import plural_or_not, is_string
from SeleniumLibrary.utils import plural_or_not


class WindowKeywords(LibraryComponent):
Expand Down Expand Up @@ -117,7 +117,7 @@ def switch_window(
except NoSuchWindowException:
pass
finally:
if not is_string(browser) or not browser.upper() == "CURRENT":
if not isinstance(browser, str) or not browser.upper() == "CURRENT":
self.drivers.switch(browser)
self._window_manager.select(locator, timeout)

Expand Down
11 changes: 5 additions & 6 deletions src/SeleniumLibrary/locators/windowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from SeleniumLibrary.base import ContextAware
from SeleniumLibrary.errors import WindowNotFound
from SeleniumLibrary.utils import is_string


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

def get_window_handles(self, browser):
if is_string(browser) and browser == "ALL":
if isinstance(browser, str) and browser == "ALL":
handles = []
current_index = self.drivers.current_index
for index, driver in enumerate(self.drivers, 1):
self.drivers.switch(index)
handles.extend(self.driver.window_handles)
self.drivers.switch(current_index)
return handles
elif is_string(browser) and browser == "CURRENT":
elif isinstance(browser, str) and browser == "CURRENT":
return self.driver.window_handles
else:
current_index = self.drivers.current_index
Expand All @@ -60,14 +59,14 @@ def get_window_infos(self, browser="CURRENT"):
current_index = self.drivers.current_index
except AttributeError:
current_index = None
if is_string(browser) and browser.upper() == "ALL":
if isinstance(browser, str) and browser.upper() == "ALL":
infos = []
for index, driver in enumerate(self.drivers, 1):
self.drivers.switch(index)
infos.extend(self._get_window_infos())
self.drivers.switch(current_index)
return infos
elif is_string(browser) and browser.upper() == "CURRENT":
elif isinstance(browser, str) and browser.upper() == "CURRENT":
return self._get_window_infos()
else:
self.drivers.switch(browser)
Expand Down Expand Up @@ -100,7 +99,7 @@ def select(self, locator, timeout=0):
time.sleep(0.1)

def _select(self, locator):
if not is_string(locator):
if not isinstance(locator, str):
self._select_by_excludes(locator)
elif locator.upper() == "CURRENT":
pass
Expand Down
1 change: 0 additions & 1 deletion src/SeleniumLibrary/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from .types import (
is_falsy,
is_noney,
is_string,
is_truthy,
WINDOWS,
_convert_timeout,
Expand Down
4 changes: 2 additions & 2 deletions src/SeleniumLibrary/utils/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from datetime import timedelta
from typing import Any

from robot.utils import is_string, timestr_to_secs
from robot.utils import timestr_to_secs
from robot.utils import is_truthy, is_falsy # noqa

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


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

def _convert_delay(delay):
if isinstance(delay, timedelta):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ SeleniumLibrary can be imported with several optional arguments.
- ``run_on_failure``:
Default action for the `run-on-failure functionality`.
- ``screenshot_root_directory``:
Path to folder where possible screenshots are created or EMBED.
See `Set Screenshot Directory` keyword for further details about EMBED.
Path to folder where possible screenshots are created or EMBED or BASE64.
See `Set Screenshot Directory` keyword for further details about EMBED and BASE64.
If not given, the directory where the log file is written is used.
- ``plugins``:
Allows extending the SeleniumLibrary with external Python classes.
Expand Down