From 74265498a954a1a49f7ea0198d26bdff9cbd2414 Mon Sep 17 00:00:00 2001 From: remontees Date: Tue, 9 Mar 2021 09:54:45 +0100 Subject: [PATCH 001/407] Update webdrivertools.py Support Edge webdriver for Linux. --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index c9a8cc7c1..6fe3ce66b 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -285,7 +285,7 @@ def create_edge( remote_url, options=None, service_log_path=None, - executable_path="MicrosoftWebDriver.exe", + executable_path="msedgedriver", ): if remote_url: defaul_caps = webdriver.DesiredCapabilities.EDGE.copy() From 82a6663a4f466ec0dc187c0e6dc07fe98e9b2c8e Mon Sep 17 00:00:00 2001 From: Tatu Aalto <2665023+aaltat@users.noreply.github.com> Date: Fri, 11 Jun 2021 00:32:12 +0300 Subject: [PATCH 002/407] Update PLC to 3.0.0 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 906e7fdb2..208e2a757 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ selenium >= 3.141.0 robotframework >= 3.2.2 -robotframework-pythonlibcore >= 2.2.1 +robotframework-pythonlibcore >= 3.0.0 From 22546564a2acffc3262f2bcca6b4e424cccba23b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Aug 2021 20:50:04 -0400 Subject: [PATCH 003/407] Added clarifying information about timeouts Changes made by Dave Martin @sparkymartin --- src/SeleniumLibrary/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index c47ee4100..ac73ec11d 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -340,7 +340,9 @@ class SeleniumLibrary(DynamicCore): The default timeout these keywords use can be set globally either by using the `Set Selenium Timeout` keyword or with the ``timeout`` argument - when `importing` the library. See `time format` below for supported + when `importing` the library. If no default timeout is set globally, the + default is 5 seconds. If None is specified for the timeout argument in the + keywords, the default is used. See `time format` below for supported timeout syntax. == Implicit wait == From 0d73cd488dffeb634dbf9164f61c2c8ab953b0b7 Mon Sep 17 00:00:00 2001 From: DetachHead <57028336+DetachHead@users.noreply.github.com> Date: Mon, 6 Dec 2021 09:58:56 +1000 Subject: [PATCH 004/407] fix `StringIO` import as it was removed in robot 5.0 --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index c9a8cc7c1..a3816f608 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -19,10 +19,11 @@ import os import token import warnings +from io import StringIO from tokenize import generate_tokens from robot.api import logger -from robot.utils import ConnectionCache, StringIO +from robot.utils import ConnectionCache from selenium import webdriver from selenium.webdriver import FirefoxProfile From 7769ed6fe6565007c4938664ce7f84cce343c4cd Mon Sep 17 00:00:00 2001 From: Diego Date: Tue, 19 Apr 2022 15:57:43 -0700 Subject: [PATCH 005/407] Fixes "resent" with "recent" Fixes a small mistake that changed the meaning completely :) --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index c4ba624cd..24a36213c 100644 --- a/README.rst +++ b/README.rst @@ -62,7 +62,7 @@ To install the last legacy Selenium2Library_ version, use this command instead:: pip install robotframework-selenium2library==1.8.0 -With resent versions of ``pip`` it is possible to install directly from the +With recent versions of ``pip`` it is possible to install directly from the GitHub_ repository. To install latest source from the master branch, use this command:: From 2388e65ae9e7b91993c2fed905d27d1d90776beb Mon Sep 17 00:00:00 2001 From: Luciano Martorella Date: Tue, 13 Jul 2021 16:43:19 +0200 Subject: [PATCH 006/407] - Added minimize keyword - Added atest --- atest/acceptance/windows.robot | 24 ++++++++++++++++++++++++ src/SeleniumLibrary/keywords/window.py | 5 +++++ 2 files changed, 29 insertions(+) diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index b9a6c5d38..7bcf9fdf8 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -108,6 +108,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 diff --git a/src/SeleniumLibrary/keywords/window.py b/src/SeleniumLibrary/keywords/window.py index 43588d7d5..01feee1fe 100644 --- a/src/SeleniumLibrary/keywords/window.py +++ b/src/SeleniumLibrary/keywords/window.py @@ -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. From 994a13885276a0931c1aac358700f78dab7c9c4b Mon Sep 17 00:00:00 2001 From: Luciano Martorella Date: Fri, 29 Jul 2022 17:28:17 +0200 Subject: [PATCH 007/407] - Fixed kw count --- utest/test/api/test_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 7218e637b..fd4d06ff4 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 173) + self.assertEqual(len(sl.get_keyword_names()), 174) def test_parse_library(self): plugin = "path.to.MyLibrary" From 0be8fd79b8413154ec044c0f8f715cd76e6c6107 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 3 Oct 2022 18:48:30 -0400 Subject: [PATCH 008/407] Removed Opera as it is no longer supported by Selenium Opera support was depreciated in Selenium version 4.2.0 and was removed in version 4.3.0. Thus we have removed it from SeleniumLibrary. --- .../keywords/browsermanagement.py | 4 +- .../keywords/webdrivertools/webdrivertools.py | 24 -------- ..._options_parser.test_importer.approved.txt | 11 ++-- .../keywords/test_selenium_options_parser.py | 30 ---------- utest/test/keywords/test_webdrivercreator.py | 58 ------------------- .../test_webdrivercreator_executable_path.py | 24 -------- .../test_webdrivercreator_service_log_path.py | 11 ---- 7 files changed, 6 insertions(+), 156 deletions(-) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index 2d36205b1..f52ed23c4 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -83,8 +83,6 @@ def open_browser( | Internet Explorer | internetexplorer, ie | | Edge | edge | | Safari | safari | - | Opera | opera | - | Android | android | | Iphone | iphone | | PhantomJS | phantomjs | | HTMLUnit | htmlunit | @@ -354,7 +352,7 @@ def create_webdriver( the functionality provided by `Open Browser` is not adequate. ``driver_name`` must be a WebDriver implementation name like Firefox, - Chrome, Ie, Opera, Safari, PhantomJS, or Remote. + Chrome, Ie, Edge, Safari, or Remote. The initialized WebDriver can be configured either with a Python dictionary ``kwargs`` or by using keyword arguments ``**init_kwargs``. diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index c9a8cc7c1..f3d7992cb 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -45,7 +45,6 @@ class WebDriverCreator: "ie": "ie", "internetexplorer": "ie", "edge": "edge", - "opera": "opera", "safari": "safari", "phantomjs": "phantomjs", "htmlunit": "htmlunit", @@ -310,29 +309,6 @@ def create_edge( **desired_capabilities, ) - def create_opera( - self, - desired_capabilities, - remote_url, - options=None, - service_log_path=None, - executable_path="operadriver", - ): - if remote_url: - defaul_caps = webdriver.DesiredCapabilities.OPERA.copy() - desired_capabilities = self._remote_capabilities_resolver( - desired_capabilities, defaul_caps - ) - return self._remote(desired_capabilities, remote_url, options=options) - if not executable_path: - executable_path = self._get_executable_path(webdriver.Opera) - return webdriver.Opera( - options=options, - service_log_path=service_log_path, - executable_path=executable_path, - **desired_capabilities, - ) - def create_safari( self, desired_capabilities, diff --git a/utest/test/keywords/approved_files/test_selenium_options_parser.test_importer.approved.txt b/utest/test/keywords/approved_files/test_selenium_options_parser.test_importer.approved.txt index 9e265a3b4..d7e75ae1f 100644 --- a/utest/test/keywords/approved_files/test_selenium_options_parser.test_importer.approved.txt +++ b/utest/test/keywords/approved_files/test_selenium_options_parser.test_importer.approved.txt @@ -5,9 +5,8 @@ Selenium options import 2) 3) 4) -5) -6) -7) -8) htmlunit No module named -9) htmlunit_with_js No module named -10) iphone No module named +5) +6) +7) htmlunit No module named +8) htmlunit_with_js No module named +9) iphone No module named diff --git a/utest/test/keywords/test_selenium_options_parser.py b/utest/test/keywords/test_selenium_options_parser.py index bf1a1079b..bb3b3e799 100644 --- a/utest/test/keywords/test_selenium_options_parser.py +++ b/utest/test/keywords/test_selenium_options_parser.py @@ -187,7 +187,6 @@ def test_importer(options, reporter): results.append(options._import_options("chrome")) results.append(options._import_options("headless_chrome")) results.append(options._import_options("ie")) - results.append(options._import_options("opera")) results.append(options._import_options("edge")) results.append(error_formatter(options._import_options, "safari")) results.append(error_formatter(options._import_options, "htmlunit")) @@ -349,38 +348,9 @@ def test_has_options(creator): assert creator._has_options(webdriver.Firefox) assert creator._has_options(webdriver.Ie) assert creator._has_options(webdriver.Edge) - assert creator._has_options(webdriver.Opera) assert creator._has_options(webdriver.Safari) -def test_create_opera_with_options(creator): - options = mock() - expected_webdriver = mock() - executable_path = "operadriver" - when(webdriver).Opera( - options=options, service_log_path=None, executable_path=executable_path - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, None, options=options) - assert driver == expected_webdriver - - -def test_create_opera_with_options_and_remote_url(creator): - url = "http://localhost:4444/wd/hub" - caps = webdriver.DesiredCapabilities.OPERA.copy() - options = mock() - expected_webdriver = mock() - file_detector = mock_file_detector(creator) - when(webdriver).Remote( - command_executor=url, - desired_capabilities=caps, - browser_profile=None, - options=options, - file_detector=file_detector, - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, url, options=options) - assert driver == expected_webdriver - - def test_create_safari_no_options_support(creator): options = mock() expected_webdriver = mock() diff --git a/utest/test/keywords/test_webdrivercreator.py b/utest/test/keywords/test_webdrivercreator.py index 0514cdedf..40a6ca3d4 100644 --- a/utest/test/keywords/test_webdrivercreator.py +++ b/utest/test/keywords/test_webdrivercreator.py @@ -530,64 +530,6 @@ def test_edge_no_browser_name(creator): assert driver == expected_webdriver -def test_opera(creator): - expected_webdriver = mock() - executable_path = "operadriver" - when(webdriver).Opera( - options=None, service_log_path=None, executable_path=executable_path - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, None) - assert driver == expected_webdriver - - -def test_opera_remote_no_caps(creator): - url = "http://localhost:4444/wd/hub" - expected_webdriver = mock() - capabilities = webdriver.DesiredCapabilities.OPERA.copy() - file_detector = mock_file_detector(creator) - when(webdriver).Remote( - command_executor=url, - browser_profile=None, - desired_capabilities=capabilities, - options=None, - file_detector=file_detector, - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, url) - assert driver == expected_webdriver - - -def test_opera_remote_caps(creator): - url = "http://localhost:4444/wd/hub" - expected_webdriver = mock() - capabilities = {"browserName": "opera"} - file_detector = mock_file_detector(creator) - when(webdriver).Remote( - command_executor=url, - browser_profile=None, - desired_capabilities=capabilities, - options=None, - file_detector=file_detector, - ).thenReturn(expected_webdriver) - driver = creator.create_opera({"desired_capabilities": capabilities}, url) - assert driver == expected_webdriver - - -def test_opera_no_browser_name(creator): - url = "http://localhost:4444/wd/hub" - expected_webdriver = mock() - capabilities = {"browserName": "opera", "key": "value"} - file_detector = mock_file_detector(creator) - when(webdriver).Remote( - command_executor=url, - browser_profile=None, - desired_capabilities=capabilities, - options=None, - file_detector=file_detector, - ).thenReturn(expected_webdriver) - driver = creator.create_opera({"desired_capabilities": {"key": "value"}}, url) - assert driver == expected_webdriver - - def test_safari(creator): expected_webdriver = mock() executable_path = "/usr/bin/safaridriver" diff --git a/utest/test/keywords/test_webdrivercreator_executable_path.py b/utest/test/keywords/test_webdrivercreator_executable_path.py index 77111a4d4..f3b150653 100644 --- a/utest/test/keywords/test_webdrivercreator_executable_path.py +++ b/utest/test/keywords/test_webdrivercreator_executable_path.py @@ -50,9 +50,6 @@ def test_get_executable_path(creator): executable_path = creator._get_executable_path(webdriver.Ie) assert executable_path == "IEDriverServer.exe" - executable_path = creator._get_executable_path(webdriver.Opera) - assert executable_path is None - executable_path = creator._get_executable_path(webdriver.Edge) assert executable_path == "msedgedriver" @@ -207,27 +204,6 @@ def test_create_edge_executable_path_not_set(creator): assert driver == expected_webdriver -def test_create_opera_executable_path_set(creator): - executable_path = "/path/to/operadriver" - expected_webdriver = mock() - when(webdriver).Opera( - service_log_path=None, options=None, executable_path=executable_path - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, None, executable_path=executable_path) - assert driver == expected_webdriver - - -def test_create_opera_executable_path_not_set(creator): - executable_path = "operadriver" - expected_webdriver = mock() - when(creator)._get_executable_path(ANY).thenReturn(executable_path) - when(webdriver).Opera( - service_log_path=None, options=None, executable_path=executable_path - ).thenReturn(expected_webdriver) - driver = creator.create_opera({}, None, executable_path=None) - assert driver == expected_webdriver - - def test_create_safari_executable_path_set(creator): executable_path = "/path/to/safaridriver" expected_webdriver = mock() diff --git a/utest/test/keywords/test_webdrivercreator_service_log_path.py b/utest/test/keywords/test_webdrivercreator_service_log_path.py index 8b04c4003..f04a5870b 100644 --- a/utest/test/keywords/test_webdrivercreator_service_log_path.py +++ b/utest/test/keywords/test_webdrivercreator_service_log_path.py @@ -175,17 +175,6 @@ def test_create_edge_with_service_log_path_real_path(creator): assert driver == expected_webdriver -def test_create_opera_with_service_log_path_real_path(creator): - executable_path = "operadriver" - log_file = os.path.join(creator.output_dir, "ie-1.log") - expected_webdriver = mock() - when(webdriver).Opera( - options=None, service_log_path=log_file, executable_path=executable_path - ).thenReturn(expected_webdriver) - driver = creator.creator.create_opera({}, None, service_log_path=log_file) - assert driver == expected_webdriver - - def test_create_safari_no_support_for_service_log_path(creator): log_file = os.path.join(creator.output_dir, "ie-1.log") expected_webdriver = mock() From 30e1f637167d4f586fea9b63660884d8f0adec95 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 4 Oct 2022 19:40:36 -0400 Subject: [PATCH 009/407] Updated status checks on log messages Modified expected lines for log message under `Page Should Contain` test within atest/acceptance/keywords.content_assertions.robot script. Oddly the status checker gave this response, Message: Keyword 'SeleniumLibrary.Page Should Contain' (index 3) message 14 has wrong level. Expected: FAIL Actual: DEBUG Original message: Keyword 'SeleniumLibrary.Page Should Contain' (index 2) message 7 has wrong level. Expected: INFO Actual: DEBUG Original message: Keyword 'SeleniumLibrary.Page Should Contain' (index 1) message 7 has wrong level. Expected: INFO Actual: DEBUG Original message: Test failed as expected. Original message: Page should have contained text 'non existing text' but did not. of which it appears the issue was not wrong level but wrong line. That might be because it take what is expected and compares with the actual as compared to it having expert knowledge (which is what I was expecting). Now see my expectation was wrong. Testing the correction with this commit. --- atest/acceptance/keywords/content_assertions.robot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index e39a52ad6..3380d77de 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -20,9 +20,9 @@ Page Should Contain [Tags] NoGrid [Documentation] The last step fails and doesn't contain the html content. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 1:7 Current page contains text 'needle'. - ... LOG 2:7 INFO Current page contains text 'This is the haystack'. - ... LOG 3:14 FAIL Page should have contained text 'non existing text' but did not. + ... LOG 1:9 Current page contains text 'needle'. + ... LOG 2:9 INFO Current page contains text 'This is the haystack'. + ... LOG 3:18 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain needle Page Should Contain This is the haystack Page Should Contain non existing text From e3c3ab62eea8eb634c23e63762c37e3c6cccefe2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 4 Oct 2022 20:55:46 -0400 Subject: [PATCH 010/407] Updated status checks on log messages Selenium version 4.1.4 changed some of its logging so these change correct for additional logging made with these keywords. --- .../event_firing_webdriver.robot | 14 +++++------ .../selenium_move_to_workaround.robot | 10 ++++---- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/keywords/choose_file.robot | 10 ++++---- .../keywords/content_assertions.robot | 24 +++++++++---------- atest/acceptance/keywords/cookies.robot | 2 +- .../keywords/counting_elements.robot | 10 ++++---- atest/acceptance/keywords/location.robot | 4 ++-- atest/acceptance/keywords/screenshots.robot | 4 ++-- .../keywords/screenshots_embed.robot | 6 ++--- atest/acceptance/keywords/textfields.robot | 16 +++++++------ atest/acceptance/open_and_close.robot | 10 ++++---- 12 files changed, 57 insertions(+), 55 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 43590bfcf..61edab62b 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:12 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:14 INFO Got driver also from SeleniumLibrary. + ... LOG 1:15 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:17 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} @@ -22,16 +22,16 @@ Event Firing Webdriver Go To (WebDriver) [Documentation] ... LOG 1:2 INFO STARTS: Before navigate to ... LOG 1:3 INFO Got driver also from SeleniumLibrary. - ... LOG 1:7 INFO STARTS: After navigate to + ... LOG 1:8 INFO STARTS: After navigate to Go To ${ROOT}/forms/named_submit_buttons.html Event Firing Webdriver Input Text (WebElement) [Tags] NoGrid [Documentation] - ... LOG 1:5 INFO Before clear and send_keys - ... LOG 1:9 INFO After clear and send_keys - ... LOG 1:10 INFO Before clear and send_keys - ... LOG 1:14 INFO After clear and send_keys + ... LOG 1:6 INFO Before clear and send_keys + ... LOG 1:11 INFO After clear and send_keys + ... LOG 1:12 INFO Before clear and send_keys + ... LOG 1:17 INFO After clear and send_keys Input Text //input[@name="textfield"] FooBar Event Firing Webdriver With Get WebElement (WebElement) diff --git a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot b/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot index 290cdfb2f..839afe635 100644 --- a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot +++ b/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot @@ -14,19 +14,19 @@ ${CTRL_OR_COMMAND} ${EMPTY} *** Test Cases *** Selenium move_to workaround Click Element At Coordinates - [Documentation] LOG 1:5 DEBUG Workaround for Selenium 3 bug. + [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. Click Element At Coordinates id:some_id 4 4 Selenium move_to workaround Scroll Element Into View - [Documentation] LOG 1:4 DEBUG Workaround for Selenium 3 bug. + [Documentation] LOG 1:5 DEBUG Workaround for Selenium 3 bug. Scroll Element Into View id:some_id Selenium move_to workaround Mouse Out - [Documentation] LOG 1:5 DEBUG Workaround for Selenium 3 bug. + [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. Mouse Out id:some_id Selenium move_to workaround Mouse Over - [Documentation] LOG 1:5 DEBUG Workaround for Selenium 3 bug. + [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. Mouse Over id:some_id Click Element @@ -46,7 +46,7 @@ Click Element Action Chain [Tags] NoGrid [Documentation] ... LOB SETUP:1 INFO Clicking 'singleClickButton' using an action chain. - ... LOG 1:6 DEBUG GLOB: *actions {"actions": [{* + ... LOG 1:7 DEBUG GLOB: *actions {"actions": [{* [Setup] Initialize Page For Click Element Click Element singleClickButton action_chain=True Element Text Should Be output single clicked diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 3af2daff0..9198268e4 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:6 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:7 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} diff --git a/atest/acceptance/keywords/choose_file.robot b/atest/acceptance/keywords/choose_file.robot index b7b75c57f..e0ab44196 100644 --- a/atest/acceptance/keywords/choose_file.robot +++ b/atest/acceptance/keywords/choose_file.robot @@ -44,11 +44,11 @@ Choose File With Grid From Library Using SL choose_file method Input Text Should Work Same Way When Not Using Grid [Documentation] - ... LOG 1:5 DEBUG GLOB: POST*/session/*/clear {"* - ... LOG 1:7 DEBUG Finished Request - ... LOG 1:8 DEBUG GLOB: POST*/session/*/value*"text": "* - ... LOG 1:10 DEBUG Finished Request - ... LOG 1:11 DEBUG NONE + ... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {"* + ... LOG 1:9 DEBUG Finished Request + ... LOG 1:10 DEBUG GLOB: POST*/session/*/value*"text": "* + ... LOG 1:13 DEBUG Finished Request + ... LOG 1:14 DEBUG NONE [Tags] NoGrid [Setup] Touch ${CURDIR}${/}temp.txt Input Text file_to_upload ${CURDIR}${/}temp.txt diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index 3380d77de..03559fe17 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -7,7 +7,7 @@ Resource ../resource.robot *** Test Cases *** Title Should Be [Tags] NoGrid - [Documentation] LOG 1:4 Page title is '(root)/index.html'. + [Documentation] LOG 1:5 Page title is '(root)/index.html'. Title Should Be (root)/index.html Run Keyword And Expect Error ... Title should have been 'not a title' but was '(root)/index.html'. @@ -41,16 +41,16 @@ Page Should Contain With Custom Log Level DEBUG [Tags] NoGrid [Documentation] Html content is shown at DEBUG level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 1:14 DEBUG REGEXP: (?i) - ... LOG 1:15 FAIL Page should have contained text 'non existing text' but did not. + ... LOG 1:18 DEBUG REGEXP: (?i) + ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain non existing text DEBUG Page Should Contain With Custom Log Level TRACE [Tags] NoGrid [Documentation] Html content is shown at DEBUG level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 2:15 TRACE REGEXP: (?i) - ... LOG 2:16 FAIL Page should have contained text 'non existing text' but did not. + ... LOG 2:19 TRACE REGEXP: (?i) + ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. Set Log Level TRACE Page Should Contain non existing text TRACE [Teardown] Set Log Level DEBUG @@ -71,14 +71,14 @@ Page Should Not Contain [Tags] NoGrid [Documentation] Default log level does not have html output. ... FAIL Page should not have contained text 'needle'. - ... LOG 1:11 Current page does not contain text 'non existing text'. - ... LOG 2:10 FAIL Page should not have contained text 'needle'. + ... LOG 1:14 Current page does not contain text 'non existing text'. + ... LOG 2:13 FAIL Page should not have contained text 'needle'. Page Should Not Contain non existing text Page Should Not Contain needle Page Should Not Contain With Custom Log Level [Tags] NoGrid - [Documentation] LOG 1.1:10 DEBUG REGEXP: (?i) + [Documentation] LOG 1.1:13 DEBUG REGEXP: (?i) Run Keyword And Expect Error ... Page should not have contained text 'needle'. ... Page Should Not Contain needle DEBUG @@ -189,7 +189,7 @@ Get Text Page Should Contain Checkbox [Tags] NoGrid - [Documentation] LOG 1:7 Current page contains checkbox 'can_send_email'. + [Documentation] LOG 1:9 Current page contains checkbox 'can_send_email'. [Setup] Go To Page "forms/prefilled_email_form.html" Page Should Contain Checkbox can_send_email Page Should Contain Checkbox xpath=//input[@type='checkbox' and @name='can_send_sms'] @@ -199,7 +199,7 @@ Page Should Contain Checkbox Page Should Not Contain Checkbox [Tags] NoGrid - [Documentation] LOG 1:7 Current page does not contain checkbox 'non-existing'. + [Documentation] LOG 1:9 Current page does not contain checkbox 'non-existing'. [Setup] Go To Page "forms/prefilled_email_form.html" Page Should Not Contain Checkbox non-existing Run Keyword And Expect Error @@ -290,7 +290,7 @@ Page Should Not Contain Text Field TextField Should Contain [Tags] NoGrid - [Documentation] LOG 1:10 Text field 'name' contains text ''. + [Documentation] LOG 1:13 Text field 'name' contains text ''. [Setup] Go To Page "forms/email_form.html" TextField Should contain name ${EMPTY} TextField Should contain website ${EMPTY} @@ -307,7 +307,7 @@ TextField Should Contain TextField Value Should Be [Tags] NoGrid - [Documentation] LOG 1:10 Content of text field 'name' is ''. + [Documentation] LOG 1:13 Content of text field 'name' is ''. [Setup] Go To Page "forms/email_form.html" textfield Value Should Be name ${EMPTY} Input Text name my name diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 8a931e7d5..1c6d92b1c 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -106,7 +106,7 @@ Test Get Cookie Object Value Test Get Cookie Keyword Logging [Tags] NoGrid [Documentation] - ... LOG 1:4 ${cookie} = name=another + ... LOG 1:5 ${cookie} = name=another ... value=value ... path=/ ... domain=localhost diff --git a/atest/acceptance/keywords/counting_elements.robot b/atest/acceptance/keywords/counting_elements.robot index 737b1b887..95dc87897 100644 --- a/atest/acceptance/keywords/counting_elements.robot +++ b/atest/acceptance/keywords/counting_elements.robot @@ -35,13 +35,13 @@ Page Should Contain Element When Limit Is None Page Should Contain Element When Limit Is Number [Tags] NoGrid - [Documentation] LOG 1:4 INFO Current page contains 2 element(s). + [Documentation] LOG 1:5 INFO Current page contains 2 element(s). [Setup] Go To Page "links.html" Page Should Contain Element name: div_name limit=2 Page Should Contain Element Log Level Does Not Affect When Keyword Passes [Tags] NoGrid - [Documentation] LOG 1:4 INFO Current page contains 2 element(s). + [Documentation] LOG 1:5 INFO Current page contains 2 element(s). [Setup] Go To Page "links.html" Page Should Contain Element name: div_name loglevel=debug limit=2 @@ -64,9 +64,9 @@ Page Should Contain Element When Error With Limit And Different Loglevels [Tags] NoGrid [Documentation] Only at DEBUG loglevel is the html placed in the log. ... FAIL Page should have contained "99" element(s), but it did contain "2" element(s). - ... LOG 1.1:7 FAIL Page should have contained "99" element(s), but it did contain "2" element(s). - ... LOG 2:7 DEBUG REGEXP: .*links\\.html.* - ... LOG 2:8 FAIL Page should have contained "99" element(s), but it did contain "2" element(s). + ... LOG 1.1:9 FAIL Page should have contained "99" element(s), but it did contain "2" element(s). + ... LOG 2:9 DEBUG REGEXP: .*links\\.html.* + ... LOG 2:10 FAIL Page should have contained "99" element(s), but it did contain "2" element(s). [Setup] Go To Page "links.html" Run Keyword And Ignore Error ... Page Should Contain Element name: div_name limit=99 diff --git a/atest/acceptance/keywords/location.robot b/atest/acceptance/keywords/location.robot index 0518f202e..80c260df7 100644 --- a/atest/acceptance/keywords/location.robot +++ b/atest/acceptance/keywords/location.robot @@ -6,7 +6,7 @@ Resource ../resource.robot *** Test Cases *** Location Should Be [Tags] NoGrid - [Documentation] LOG 1:4 Current location is '${FRONT PAGE}'. + [Documentation] LOG 1:5 Current location is '${FRONT PAGE}'. Location Should Be ${FRONT PAGE} Location Should Be ${FRONT PAGE} message=taco Location Should Be ${FRONT PAGE} message=None @@ -22,7 +22,7 @@ Location Should Be Location Should Contain [Tags] NoGrid - [Documentation] LOG 1:4 Current location contains 'html'. + [Documentation] LOG 1:5 Current location contains 'html'. Location Should Contain html Location Should Contain html message=foobar Location Should Contain html message=None diff --git a/atest/acceptance/keywords/screenshots.robot b/atest/acceptance/keywords/screenshots.robot index f39c28ee6..49165bf20 100644 --- a/atest/acceptance/keywords/screenshots.robot +++ b/atest/acceptance/keywords/screenshots.robot @@ -8,8 +8,8 @@ Force Tags Known Issue Internet Explorer Capture page screenshot to default location [Tags] NoGrid [Documentation] - ... LOG 1:4 - ... LOG 7:4 + ... LOG 1:5 + ... LOG 7:5 [Setup] Remove Files ${OUTPUTDIR}/selenium-screenshot-*.png ${file} = Capture Page Screenshot ${count} = Count Files In Directory ${OUTPUTDIR} selenium-screenshot-*.png diff --git a/atest/acceptance/keywords/screenshots_embed.robot b/atest/acceptance/keywords/screenshots_embed.robot index 862743afa..2c8799126 100644 --- a/atest/acceptance/keywords/screenshots_embed.robot +++ b/atest/acceptance/keywords/screenshots_embed.robot @@ -5,7 +5,7 @@ Resource ../resource.robot Capture Page Screenshot Embedded By Screenshot Root Directory [Tags] NoGrid [Documentation] - ... LOG 2:4 INFO STARTS: screenshotscreenshotscreenshotscreenshotscreenshotscreenshot Date: Tue, 4 Oct 2022 21:09:34 -0400 Subject: [PATCH 011/407] Updated status checks on log messages Selenium version 4.1.4 changed some of its logging so these change correct for additional logging made with these keywords. --- atest/acceptance/keywords/click_element.robot | 2 +- atest/acceptance/keywords/textfields.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/click_element.robot b/atest/acceptance/keywords/click_element.robot index 2466a181b..1f3a43a2b 100644 --- a/atest/acceptance/keywords/click_element.robot +++ b/atest/acceptance/keywords/click_element.robot @@ -40,7 +40,7 @@ Click Element Action Chain [Tags] NoGrid [Documentation] ... LOB 1:1 INFO Clicking 'singleClickButton' using an action chain. - ... LOG 1:6 DEBUG GLOB: *actions {"actions": [{* + ... LOG 1:7 DEBUG GLOB: *actions {"actions": [{* Click Element singleClickButton action_chain=True Element Text Should Be output single clicked diff --git a/atest/acceptance/keywords/textfields.robot b/atest/acceptance/keywords/textfields.robot index 22f6a5143..a537ecd64 100644 --- a/atest/acceptance/keywords/textfields.robot +++ b/atest/acceptance/keywords/textfields.robot @@ -32,7 +32,7 @@ Input Password Should Not Log Password String ... LOG 1:1 INFO Typing password into text field 'password_field'. ... LOG 1:2 DEBUG STARTS: POST http ... LOG 1:3 DEBUG STARTS: http - ... LOG 1:3 DEBUG STARTS: Remote response + ... LOG 1:4 DEBUG STARTS: Remote response ... LOG 1:5 DEBUG Finished Request ... LOG 1:6 DEBUG STARTS: POST http ... LOG 1:7 DEBUG STARTS: http From 1355b6658a45cff921538f903b1b3d866e22cfa9 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Sat, 24 Sep 2022 21:11:33 +0300 Subject: [PATCH 012/407] Change cookie expiry times in cookie tests --- atest/acceptance/keywords/cookies.robot | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 1c6d92b1c..4dab4ef8e 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -35,15 +35,15 @@ Add Cookie When Secure Is False Should Be Equal ${cookie.secure} ${False} Add Cookie When Expiry Is Epoch - Add Cookie Cookie1 value1 expiry=1822137695 + Add Cookie Cookie1 value1 expiry=1698601011 ${cookie} = Get Cookie Cookie1 - ${expiry} = Convert Date ${1822137695} exclude_millis=True + ${expiry} = Convert Date ${1698601011} exclude_millis=True Should Be Equal As Strings ${cookie.expiry} ${expiry} Add Cookie When Expiry Is Human Readable Data&Time - Add Cookie Cookie12 value12 expiry=2027-09-28 16:21:35 + Add Cookie Cookie12 value12 expiry=2023-10-29 19:36:51 ${cookie} = Get Cookie Cookie12 - Should Be Equal As Strings ${cookie.expiry} 2027-09-28 16:21:35 + Should Be Equal As Strings ${cookie.expiry} 2023-10-29 19:36:51 Delete Cookie [Tags] Known Issue Safari @@ -71,12 +71,12 @@ Get Cookies As Dict When There Are None Test Get Cookie Object Expiry ${cookie} = Get Cookie another - Should Be Equal As Integers ${cookie.expiry.year} 2027 - Should Be Equal As Integers ${cookie.expiry.month} 09 - Should Be Equal As Integers ${cookie.expiry.day} 28 - Should Be Equal As Integers ${cookie.expiry.hour} 16 - Should Be Equal As Integers ${cookie.expiry.minute} 21 - Should Be Equal As Integers ${cookie.expiry.second} 35 + Should Be Equal As Integers ${cookie.expiry.year} 2023 + Should Be Equal As Integers ${cookie.expiry.month} 10 + Should Be Equal As Integers ${cookie.expiry.day} 29 + Should Be Equal As Integers ${cookie.expiry.hour} 19 + Should Be Equal As Integers ${cookie.expiry.minute} 36 + Should Be Equal As Integers ${cookie.expiry.second} 51 Should Be Equal As Integers ${cookie.expiry.microsecond} 0 Test Get Cookie Object Domain @@ -112,11 +112,11 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2027-09-28 16:21:35 + ... expiry=2023-10-29 19:36:51 ${cookie} = Get Cookie another *** Keyword *** Add Cookies Delete All Cookies Add Cookie test seleniumlibrary - Add Cookie another value expiry=2027-09-28 16:21:35 + Add Cookie another value expiry=2023-10-29 19:36:51 From f988fdfadf43398ab10d6997dbb00fb96ae0dacc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 5 Oct 2022 06:41:57 -0400 Subject: [PATCH 013/407] Removed lingering instances of Opera browers from atest Also removed instances of phantomJS, iPhone, Andriod. Need to review Create WebDriver code as atest did not catch these. --- atest/acceptance/create_webdriver.robot | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 9198268e4..5f017fdbd 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -36,15 +36,13 @@ Create Webdriver With Bad Keyword Argument Dictionary Set Driver Variables [Documentation] Selects proper driver ${drivers}= Create Dictionary ff=Firefox firefox=Firefox ie=Ie - ... internetexplorer=Ie googlechrome=Chrome gc=Chrome - ... chrome=Chrome opera=Opera phantomjs=PhantomJS safari=Safari - ... headlesschrome=Chrome headlessfirefox=Firefox + ... internetexplorer=Ie googlechrome=Chrome gc=Chrome chrome=Chrome + ... safari=Safari headlesschrome=Chrome headlessfirefox=Firefox ${name}= Evaluate "Remote" if "${REMOTE_URL}"!="None" else $drivers["${BROWSER}"] Set Test Variable ${DRIVER_NAME} ${name} ${dc names}= Create Dictionary ff=FIREFOX firefox=FIREFOX ie=INTERNETEXPLORER ... internetexplorer=INTERNETEXPLORER googlechrome=CHROME gc=CHROME - ... chrome=CHROME opera=OPERA phantomjs=PHANTOMJS htmlunit=HTMLUNIT - ... htmlunitwithjs=HTMLUNITWITHJS android=ANDROID iphone=IPHONE + ... chrome=CHROME htmlunit=HTMLUNIT htmlunitwithjs=HTMLUNITWITHJS ... safari=SAFARI headlessfirefox=FIREFOX headlesschrome=CHROME ${dc name}= Get From Dictionary ${dc names} ${BROWSER.lower().replace(' ', '')} ${caps}= Evaluate selenium.webdriver.DesiredCapabilities.${dc name} From 848eaa889c9b064dc98abac17e856ce40fde5947 Mon Sep 17 00:00:00 2001 From: remontees Date: Tue, 9 Mar 2021 09:54:45 +0100 Subject: [PATCH 014/407] Update webdrivertools.py Support Edge webdriver for Linux. --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index f3d7992cb..6d9811506 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -284,7 +284,7 @@ def create_edge( remote_url, options=None, service_log_path=None, - executable_path="MicrosoftWebDriver.exe", + executable_path="msedgedriver", ): if remote_url: defaul_caps = webdriver.DesiredCapabilities.EDGE.copy() From 1bccbcaf5f06ff82f46c4ae430d86e915e9961f5 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 8 Oct 2022 18:26:19 -0400 Subject: [PATCH 015/407] Updated unit tests for using msedgedriver Also modified log file name for edge and safari to reflect the driver instead of using "ie" within log file name. --- utest/test/keywords/test_webdrivercreator.py | 2 +- .../test/keywords/test_webdrivercreator_executable_path.py | 4 ++-- .../test/keywords/test_webdrivercreator_service_log_path.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/utest/test/keywords/test_webdrivercreator.py b/utest/test/keywords/test_webdrivercreator.py index 40a6ca3d4..e246ae0c8 100644 --- a/utest/test/keywords/test_webdrivercreator.py +++ b/utest/test/keywords/test_webdrivercreator.py @@ -472,7 +472,7 @@ def test_ie_no_browser_name(creator): def test_edge(creator): - executable_path = "MicrosoftWebDriver.exe" + executable_path = "msedgedriver" expected_webdriver = mock() when(webdriver).Edge( service_log_path=None, executable_path=executable_path diff --git a/utest/test/keywords/test_webdrivercreator_executable_path.py b/utest/test/keywords/test_webdrivercreator_executable_path.py index f3b150653..e8e5022fb 100644 --- a/utest/test/keywords/test_webdrivercreator_executable_path.py +++ b/utest/test/keywords/test_webdrivercreator_executable_path.py @@ -182,7 +182,7 @@ def test_create_ie_executable_path_not_set(creator): def test_create_edge_executable_path_set(creator): - executable_path = "/path/to/MicrosoftWebDriver.exe" + executable_path = "/path/to/msedgedriver" expected_webdriver = mock() when(creator)._has_options(ANY).thenReturn(False) when(webdriver).Edge( @@ -193,7 +193,7 @@ def test_create_edge_executable_path_set(creator): def test_create_edge_executable_path_not_set(creator): - executable_path = "MicrosoftWebDriver.exe" + executable_path = "msedgedriver" expected_webdriver = mock() when(creator)._get_executable_path(ANY).thenReturn(executable_path) when(creator)._has_options(ANY).thenReturn(False) diff --git a/utest/test/keywords/test_webdrivercreator_service_log_path.py b/utest/test/keywords/test_webdrivercreator_service_log_path.py index f04a5870b..57e2f18f8 100644 --- a/utest/test/keywords/test_webdrivercreator_service_log_path.py +++ b/utest/test/keywords/test_webdrivercreator_service_log_path.py @@ -164,8 +164,8 @@ def test_create_ie_with_service_log_path_real_path(creator): def test_create_edge_with_service_log_path_real_path(creator): - executable_path = "MicrosoftWebDriver.exe" - log_file = os.path.join(creator.output_dir, "ie-1.log") + executable_path = "msedgedriver" + log_file = os.path.join(creator.output_dir, "edge-1.log") expected_webdriver = mock() when(creator.creator)._has_options(ANY).thenReturn(False) when(webdriver).Edge( @@ -176,7 +176,7 @@ def test_create_edge_with_service_log_path_real_path(creator): def test_create_safari_no_support_for_service_log_path(creator): - log_file = os.path.join(creator.output_dir, "ie-1.log") + log_file = os.path.join(creator.output_dir, "safari-1.log") expected_webdriver = mock() executable_path = "/usr/bin/safaridriver" when(webdriver).Safari(executable_path=executable_path).thenReturn( From 1af5e50f1b5b3151a77181e311693a51e22bb356 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Fri, 7 Oct 2022 14:32:45 +0300 Subject: [PATCH 016/407] Remove 'Known Issue Chrome' tags from two tests as they pass with Chrome --- atest/acceptance/windows.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index b9a6c5d38..48a45d694 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -95,14 +95,14 @@ Get and Set Inner Window Size with Frames ... Set Window Size ${400} ${300} ${True} Get and Set Window Position - [Tags] Known Issue Chrome Known Issue Safari + [Tags] Known Issue Safari Set Window Position ${300} ${200} ${x} ${y}= Get Window Position Should Be Equal ${x} ${300} Should Be Equal ${y} ${200} Set Window Position using strings - [Tags] Known Issue Chrome Known Issue Safari + [Tags] Known Issue Safari Set Window Position 200 100 ${x} ${y}= Get Window Position Should Be Equal ${x} ${200} From ed9fbe2be1ed331a9baf3664ad6455045910564c Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Fri, 7 Oct 2022 14:32:35 +0300 Subject: [PATCH 017/407] Replace deprecated rebot option with robot option --- atest/run.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/atest/run.py b/atest/run.py index 583d801a2..d02d516e9 100755 --- a/atest/run.py +++ b/atest/run.py @@ -97,8 +97,6 @@ REBOT_OPTIONS = [ "--outputdir", RESULTS_DIR, - "--noncritical", - "known issue {browser}", ] @@ -208,6 +206,7 @@ def execute_tests(interpreter, browser, rf_options, grid, event_firing): options.extend([opt.format(browser=browser) for opt in ROBOT_OPTIONS]) if rf_options: options += rf_options + options += ["--exclude", f"known issue {browser.replace('headless', '')}"] command = runner if grid: command += [ From 09325c3986cd723553788976b02312816d70a849 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Sun, 9 Oct 2022 13:47:27 +0300 Subject: [PATCH 018/407] Update 'checkout' and 'setup-python' actions --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 75d50ab30..ab1718f21 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,9 +12,9 @@ jobs: rf-version: [3.2.2, 4.1.3] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Start xvfb From bbca65d61173a141cf327d94a2838c9df506c4e7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 9 Oct 2022 08:29:10 -0400 Subject: [PATCH 019/407] Updated expected documentation text based upon recent change --- .../PluginDocumentation.test_many_plugins.approved.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt index 030b98ddd..95bb3f270 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt @@ -283,7 +283,9 @@ can run. The default timeout these keywords use can be set globally either by using the `Set Selenium Timeout` keyword or with the ``timeout`` argument -when `importing` the library. See `time format` below for supported +when `importing` the library. If no default timeout is set globally, the +default is 5 seconds. If None is specified for the timeout argument in the +keywords, the default is used. See `time format` below for supported timeout syntax. == Implicit wait == From 426e40f890c7d46e67e84985a23fa8f7f0e60340 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 10 Oct 2022 09:22:05 -0400 Subject: [PATCH 020/407] Adding in rf V5.0.1 and beta release 5.1, release candidate 6.0 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 75d50ab30..d668cc60f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [3.7, 3.9, pypy-3.7] - rf-version: [3.2.2, 4.1.3] + rf-version: [3.2.2, 4.1.3, 5.0.1, 5.1b2, 6.0rc1] steps: - uses: actions/checkout@v2 From 486a30841733f4a40dd9b46c67d0781304de54de Mon Sep 17 00:00:00 2001 From: DetachHead <57028336+DetachHead@users.noreply.github.com> Date: Mon, 6 Dec 2021 09:58:56 +1000 Subject: [PATCH 021/407] fix `StringIO` import as it was removed in robot 5.0 --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 6d9811506..cf30f2946 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -19,10 +19,11 @@ import os import token import warnings +from io import StringIO from tokenize import generate_tokens from robot.api import logger -from robot.utils import ConnectionCache, StringIO +from robot.utils import ConnectionCache from selenium import webdriver from selenium.webdriver import FirefoxProfile From b0afa4ef5c8f1ad262eeac1c1aebe8d5866433fe Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 10 Oct 2022 10:37:51 -0400 Subject: [PATCH 022/407] Removed beta and release candidates --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d668cc60f..77c51e5ab 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [3.7, 3.9, pypy-3.7] - rf-version: [3.2.2, 4.1.3, 5.0.1, 5.1b2, 6.0rc1] + rf-version: [3.2.2, 4.1.3, 5.0.1] steps: - uses: actions/checkout@v2 From c09ff6bb9898132e4a0d5adc0f909a382008800f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 10 Oct 2022 15:17:48 -0400 Subject: [PATCH 023/407] Use python interpreter that executed atest/run.py instead of python When running under a virtualenv, using `python` as the interpreter forgets the virtualenv python which executed atest.run.py. Instead using sys.executable which will execute with same interpreter used to execute atest/run.py. I also later check to make sure the interpreter is not None nor an empty string as doc states [1] it may be if "Python is unable to retrieve the interpreter". Fixes #1796 [1] https://docs.python.org/3.10/library/sys.html#sys.executable --- atest/run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/run.py b/atest/run.py index 583d801a2..3567e4f59 100755 --- a/atest/run.py +++ b/atest/run.py @@ -277,7 +277,7 @@ def create_zip(): parser.add_argument( "--interpreter", "-I", - default="python", + default=sys.executable, help=textwrap.dedent( """\ Any Python interpreter supported by the library. @@ -313,7 +313,7 @@ def create_zip(): args, rf_options = parser.parse_known_args() browser = args.browser.lower().strip() selenium_grid = is_truthy(args.grid) - interpreter = args.interpreter + interpreter = "python" if not args.interpreter else args.interpreter event_firing_webdriver = args.event_firing_webdriver if args.nounit: print("Not running unit tests.") From 8c86329be3c2d4837c0bcff5fd139dcb219efa9e Mon Sep 17 00:00:00 2001 From: Tatu Aalto <2665023+aaltat@users.noreply.github.com> Date: Mon, 10 Oct 2022 22:18:48 +0300 Subject: [PATCH 024/407] Fox windowns utest running --- tasks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks.py b/tasks.py index ced30c3b9..fd21efe57 100644 --- a/tasks.py +++ b/tasks.py @@ -221,7 +221,7 @@ def utest(ctx, suite=None): Args: suite: Select which suite to run. """ - command = "python utest/run.py" + command = f"{sys.executable} utest/run.py" if suite: command = f"{command} --suite {suite}" ctx.run(command) From fc2a7d701a287ebb396e668ac19d8a9ec4259805 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 10 Oct 2022 17:48:05 -0400 Subject: [PATCH 025/407] Added python interpreter to the http_server This will ensure the usage of the same python environment for the http server as the one that starts the atest runner. --- atest/run.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/atest/run.py b/atest/run.py index 3567e4f59..8d9d2c621 100755 --- a/atest/run.py +++ b/atest/run.py @@ -110,7 +110,7 @@ def acceptance_tests( os.mkdir(RESULTS_DIR) if grid: hub, node = start_grid() - with http_server(): + with http_server(interpreter): execute_tests(interpreter, browser, rf_options, grid, event_firing) failures = process_output(browser) if failures: @@ -179,17 +179,18 @@ def _grid_status(status=False, role="hub"): @contextmanager -def http_server(): +def http_server(interpreter): serverlog = open(os.path.join(RESULTS_DIR, "serverlog.txt"), "w") + interpreter = "python" if not interpreter else interpreter process = subprocess.Popen( - ["python", HTTP_SERVER_FILE, "start"], + [interpreter, HTTP_SERVER_FILE, "start"], stdout=serverlog, stderr=subprocess.STDOUT, ) try: yield finally: - subprocess.call(["python", HTTP_SERVER_FILE, "stop"]) + subprocess.call([interpreter, HTTP_SERVER_FILE, "stop"]) process.wait() serverlog.close() From 2d56a222eb60887406ab15f63dc7c96504576330 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 21 Dec 2022 14:39:00 -0500 Subject: [PATCH 026/407] Replaced RemoteDriverServerException with WebDriverException In a few unit test cases we were using a generic exception for testing the webdriver cache. That exception was depreciated and I replaced it with another. --- utest/test/keywords/test_webdrivercache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utest/test/keywords/test_webdrivercache.py b/utest/test/keywords/test_webdrivercache.py index f93a8158d..f138565f2 100644 --- a/utest/test/keywords/test_webdrivercache.py +++ b/utest/test/keywords/test_webdrivercache.py @@ -2,7 +2,7 @@ from mockito import mock, verify, when, unstub from robot.utils.connectioncache import NoConnection -from selenium.common.exceptions import TimeoutException, RemoteDriverServerException +from selenium.common.exceptions import TimeoutException, WebDriverException from SeleniumLibrary.keywords import WebDriverCache @@ -180,8 +180,8 @@ def test_close_all_cache_middle_quite_fails(self): def test_close_all_cache_all_quite_fails(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(RemoteDriverServerException("stuff.")) - when(driver1).quit().thenRaise(RemoteDriverServerException("stuff.")) + when(driver0).quit().thenRaise(WebDriverException("stuff.")) + when(driver1).quit().thenRaise(WebDriverException("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") cache.register(driver1, "bar1") @@ -193,7 +193,7 @@ def test_close_all_cache_all_quite_fails(self): def test_close_all_cache_not_selenium_error(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(RemoteDriverServerException("stuff.")) + when(driver0).quit().thenRaise(WebDriverException("stuff.")) when(driver1).quit().thenRaise(ValueError("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") From 473cb7c88e0b58b5f07962235a54ef2cd39bcdbb Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 21 Dec 2022 15:37:37 -0500 Subject: [PATCH 027/407] Update robot log checker expectations --- .../event_firing_webdriver.robot | 4 ++-- atest/acceptance/create_webdriver.robot | 2 +- .../multiple_browsers_options.robot | 20 +++++++++---------- atest/acceptance/open_and_close.robot | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 61edab62b..be52107f4 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:15 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:17 INFO Got driver also from SeleniumLibrary. + ... LOG 1:16 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:18 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 5f017fdbd..41aecf659 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:7 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:8 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index e0cfaf654..a9f61eb4d 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With Selenium Options As String [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:2 DEBUG GLOB: *"--headless"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) Chrome Browser With Selenium Options Object [Documentation] - ... LOG 2:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 2:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 991b8eb71..7267c570d 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened Browser Open With Not Well-Formed URL Should Close [Documentation] Verify after incomplete 'Open Browser' browser closes - ... LOG 1.1:19 DEBUG STARTS: Opened browser with session id - ... LOG 1.1:19 DEBUG REGEXP: .*but failed to open url.* + ... LOG 1.1:20 DEBUG STARTS: Opened browser with session id + ... LOG 1.1:20 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} From 04a9f83ccd5ba6205a0c2c42e40124ba4c8ee66a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 21 Dec 2022 16:35:58 -0500 Subject: [PATCH 028/407] Update robot log checker expectations --- atest/acceptance/multiple_browsers_options.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index a9f61eb4d..b369bed06 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -47,7 +47,7 @@ Chrome Browser With Selenium Options Invalid Method Chrome Browser With Selenium Options Argument With Semicolon [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *["has;semicolon"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") From 414b864fe763c243e6932a6902894c96bdde8df5 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 21 Dec 2022 16:36:18 -0500 Subject: [PATCH 029/407] Trying out an additional tag Triage for atests under investigation There is a failing test, `multiple_browsers_executable_path.Chrome Browser With executable_path Argument`, that is failing due to a recent change/addition by the Selenium project to have a driver manager which, apparently, is correcting for this incorrect path to driver test. As there are several factors in play at this time I am kicking this test down the road. --- atest/acceptance/multiple_browsers_executable_path.robot | 2 +- atest/run.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/multiple_browsers_executable_path.robot b/atest/acceptance/multiple_browsers_executable_path.robot index c5ec2b452..df7044a86 100644 --- a/atest/acceptance/multiple_browsers_executable_path.robot +++ b/atest/acceptance/multiple_browsers_executable_path.robot @@ -10,7 +10,7 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With executable_path Argument - [Tags] NoGrid + [Tags] NoGrid Triage Run Keyword And Expect Error ... WebDriverException: Message: 'exist' executable needs to be in PATH.* ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} diff --git a/atest/run.py b/atest/run.py index d02d516e9..72670b06b 100755 --- a/atest/run.py +++ b/atest/run.py @@ -206,7 +206,7 @@ def execute_tests(interpreter, browser, rf_options, grid, event_firing): options.extend([opt.format(browser=browser) for opt in ROBOT_OPTIONS]) if rf_options: options += rf_options - options += ["--exclude", f"known issue {browser.replace('headless', '')}"] + options += ["--exclude", f"known issue {browser.replace('headless', '')}", "--exclude", "triage"] command = runner if grid: command += [ From 8163fb18f8a7c75b97e126b93965e008f522360e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 21 Dec 2022 21:48:49 -0500 Subject: [PATCH 030/407] Pulling out 3.2.2 version of Robot Framework from Github Actions Latest builds are failing in somewhat unusual places. I want to see what is the consitancy of runs for version 4.x, 5.x, and 6.x. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index cc860e1be..2569e3f40 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [3.7, 3.9, pypy-3.7] - rf-version: [3.2.2, 4.1.3, 5.0.1] + rf-version: [4.1.3, 5.0.1, 6.0.1] steps: - uses: actions/checkout@v3 From 797b272b3f85cc4f51b09d91684ff6bb7152afff Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 13:00:25 +0200 Subject: [PATCH 031/407] Add vscode settings and geckodriver log to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 506934aca..eb5c26b61 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .project .pydevproject .idea +.vscode atest/results atest/zip_results utest/output_dir @@ -10,7 +11,7 @@ utest/output_dir MANIFEST *.egg-info *.egg -chromedriver.log +*driver.log .pytest_cache dist From f160c7940e903657fae33be5c14c89005f082f7f Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 13:17:20 +0200 Subject: [PATCH 032/407] Add 'Known Issue...' tags to chrome-only tests --- atest/acceptance/multiple_browsers_executable_path.robot | 5 ++--- atest/acceptance/multiple_browsers_options.robot | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/multiple_browsers_executable_path.robot b/atest/acceptance/multiple_browsers_executable_path.robot index c5ec2b452..4ef93121d 100644 --- a/atest/acceptance/multiple_browsers_executable_path.robot +++ b/atest/acceptance/multiple_browsers_executable_path.robot @@ -3,14 +3,13 @@ Suite Teardown Close All Browsers Library ../resources/testlibs/get_selenium_options.py Resource resource.robot Documentation Creating test which would work on all browser is not possible. When testing with other -... browser than Chrome it is OK that these test will fail. SeleniumLibrary CI is run with Chrome only -... and therefore there is tests for Chrome only. +... browser than Chrome it is OK that these test will fail. ... Also it is hard to create where chromedriver location would suite in all os and enviroments, therefore ... there is a test which tests error scenario and other scenarios needed manual or unit level tests *** Test Cases *** Chrome Browser With executable_path Argument - [Tags] NoGrid + [Tags] NoGrid Known Issue Firefox Known Issue Safari Known Issue Internet Explorer Run Keyword And Expect Error ... WebDriverException: Message: 'exist' executable needs to be in PATH.* ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index e0cfaf654..b55d889b6 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -2,9 +2,9 @@ Suite Teardown Close All Browsers Library ../resources/testlibs/get_selenium_options.py Resource resource.robot -Documentation Creating test which would work on all browser is not possible. When testing with other -... browser than Chrome it is OK that these test will fail. SeleniumLibrary CI is run with Chrome only -... and therefore there is tests for Chrome only. +Force Tags Known Issue Firefox Known Issue Safari Known Issue Internet Explorer +Documentation Creating test which would work on all browser is not possible. +... These tests are for Chrome only. *** Test Cases *** Chrome Browser With Selenium Options As String From 6336504c2650c2b84830381e520df11ff77fb8ea Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Sun, 9 Oct 2022 17:16:54 +0300 Subject: [PATCH 033/407] Timeout adjustments and reliability improvements to couple of tests --- atest/acceptance/keywords/location.robot | 6 +++--- atest/acceptance/windows.robot | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/atest/acceptance/keywords/location.robot b/atest/acceptance/keywords/location.robot index 80c260df7..58525018c 100644 --- a/atest/acceptance/keywords/location.robot +++ b/atest/acceptance/keywords/location.robot @@ -106,8 +106,8 @@ Wait Until Location Is Not Fails With Timeout ${orig_timeout}= Set Selenium Timeout 2 s Click Element button Run Keyword And Expect Error - ... Location is 'http://localhost:7000/html/javascript/wait_location.html' in 1 second. - ... Wait Until Location Is Not http://localhost:7000/html/javascript/wait_location.html timeout=1 s + ... Location is 'http://localhost:7000/html/javascript/wait_location.html' in 750 milliseconds. + ... Wait Until Location Is Not http://localhost:7000/html/javascript/wait_location.html timeout=750ms Set Selenium Timeout ${orig_timeout} Wait Until Location Is Not Fails With Message @@ -165,4 +165,4 @@ Wait Until Location Does Not Contain Fail With Message [Setup] Go To Page "javascript/wait_location.html" run keyword and expect error ... my_message - ... Wait Until Location Does Not Contain wait_location.html message=my_message \ No newline at end of file + ... Wait Until Location Does Not Contain wait_location.html message=my_message diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index 48a45d694..8d6a34ccb 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -169,7 +169,7 @@ Select Popup Window With Delay By Excluded List @{excluded_handle_list}= Get Window Handles Click Button id:MyButton Switch Window ${excluded_handle_list} timeout=5 - Title Should Be Original + Wait Until Keyword Succeeds 5s 200ms Title Should Be Original Close Window Switch Window main Title Should Be Click link to show a popup window @@ -190,7 +190,7 @@ Select Window With Delay By Special Locator [Tags] Known Issue Internet Explorer Click Button id:MyButton Switch Window new timeout=5 - Title Should Be Original + Wait Until Keyword Succeeds 5s 200ms Title Should Be Original Close Window Switch Window main Title Should Be Click link to show a popup window From 5fef4a32d50c116b8f2cc0ce7a17ee6eec082d78 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 14:20:46 +0200 Subject: [PATCH 034/407] Log geckodriver logfile location at trace level --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index cf30f2946..e14c5f81e 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -228,7 +228,7 @@ def _geckodriver_log(self): log_file = self._get_log_path( os.path.join(self.log_dir, "geckodriver-{index}.log") ) - logger.info(f"Firefox driver log is always forced to to: {log_file}") + logger.trace(f"Firefox driver log is always forced to to: {log_file}") return log_file def create_headless_firefox( From cf0e25b4cd69550dd8c079d6b8094d453bdee61e Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 15:59:52 +0200 Subject: [PATCH 035/407] Adjust chrome-only tests to match new selenium logging --- .../multiple_browsers_executable_path.robot | 2 +- .../multiple_browsers_options.robot | 24 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/atest/acceptance/multiple_browsers_executable_path.robot b/atest/acceptance/multiple_browsers_executable_path.robot index 4ef93121d..9da7380c7 100644 --- a/atest/acceptance/multiple_browsers_executable_path.robot +++ b/atest/acceptance/multiple_browsers_executable_path.robot @@ -11,6 +11,6 @@ Documentation Creating test which would work on all browser is not possible. Chrome Browser With executable_path Argument [Tags] NoGrid Known Issue Firefox Known Issue Safari Known Issue Internet Explorer Run Keyword And Expect Error - ... WebDriverException: Message: 'exist' executable needs to be in PATH.* + ... STARTS: WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} executable_path=/does/not/exist diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index b55d889b6..8899526a3 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With Selenium Options As String [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:2 DEBUG GLOB: *"--headless"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) Chrome Browser With Selenium Options Object [Documentation] - ... LOG 2:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 2:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} @@ -47,7 +47,7 @@ Chrome Browser With Selenium Options Invalid Method Chrome Browser With Selenium Options Argument With Semicolon [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *["has;semicolon"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") From 1977787c46fae1d59e6ea95f142ccbbe9736131e Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 16:37:40 +0200 Subject: [PATCH 036/407] Temporarily replace 'RemoteDriverServerException' with 'Exception' in unit tests to force them to pass --- utest/test/keywords/test_webdrivercache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utest/test/keywords/test_webdrivercache.py b/utest/test/keywords/test_webdrivercache.py index f93a8158d..691221af0 100644 --- a/utest/test/keywords/test_webdrivercache.py +++ b/utest/test/keywords/test_webdrivercache.py @@ -2,7 +2,7 @@ from mockito import mock, verify, when, unstub from robot.utils.connectioncache import NoConnection -from selenium.common.exceptions import TimeoutException, RemoteDriverServerException +from selenium.common.exceptions import TimeoutException from SeleniumLibrary.keywords import WebDriverCache @@ -180,8 +180,8 @@ def test_close_all_cache_middle_quite_fails(self): def test_close_all_cache_all_quite_fails(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(RemoteDriverServerException("stuff.")) - when(driver1).quit().thenRaise(RemoteDriverServerException("stuff.")) + when(driver0).quit().thenRaise(Exception("stuff.")) + when(driver1).quit().thenRaise(Exception("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") cache.register(driver1, "bar1") @@ -193,7 +193,7 @@ def test_close_all_cache_all_quite_fails(self): def test_close_all_cache_not_selenium_error(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(RemoteDriverServerException("stuff.")) + when(driver0).quit().thenRaise(Exception("stuff.")) when(driver1).quit().thenRaise(ValueError("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") From 8fc708a32881bfdca3073d5fd74868abe9fea940 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 17:34:02 +0200 Subject: [PATCH 037/407] Remove chrome-only test that tries to open browser with nonexistent webdriver. From version 4.6 onwards Selenium will inject its own webdriver if the system doesn't have one installed. See https://www.selenium.dev/blog/2022/introducing-selenium-manager/ --- .../multiple_browsers_executable_path.robot | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 atest/acceptance/multiple_browsers_executable_path.robot diff --git a/atest/acceptance/multiple_browsers_executable_path.robot b/atest/acceptance/multiple_browsers_executable_path.robot deleted file mode 100644 index 9da7380c7..000000000 --- a/atest/acceptance/multiple_browsers_executable_path.robot +++ /dev/null @@ -1,16 +0,0 @@ -*** Settings *** -Suite Teardown Close All Browsers -Library ../resources/testlibs/get_selenium_options.py -Resource resource.robot -Documentation Creating test which would work on all browser is not possible. When testing with other -... browser than Chrome it is OK that these test will fail. -... Also it is hard to create where chromedriver location would suite in all os and enviroments, therefore -... there is a test which tests error scenario and other scenarios needed manual or unit level tests - -*** Test Cases *** -Chrome Browser With executable_path Argument - [Tags] NoGrid Known Issue Firefox Known Issue Safari Known Issue Internet Explorer - Run Keyword And Expect Error - ... STARTS: WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist - ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... desired_capabilities=${DESIRED_CAPABILITIES} executable_path=/does/not/exist From e73c831af5f44a16c352092acc10e84d78d4bd1e Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 17:36:51 +0200 Subject: [PATCH 038/407] Adjust log expectations for 'Open Browser To Start Page', 'Create Webdriver Creates Functioning WebDriver' and 'Browser Open With Not Well-Formed URL Should Close' --- .../2-event_firing_webdriver/event_firing_webdriver.robot | 4 ++-- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/open_and_close.robot | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 61edab62b..be52107f4 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:15 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:17 INFO Got driver also from SeleniumLibrary. + ... LOG 1:16 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:18 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 5f017fdbd..41aecf659 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:7 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:8 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 991b8eb71..7267c570d 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened Browser Open With Not Well-Formed URL Should Close [Documentation] Verify after incomplete 'Open Browser' browser closes - ... LOG 1.1:19 DEBUG STARTS: Opened browser with session id - ... LOG 1.1:19 DEBUG REGEXP: .*but failed to open url.* + ... LOG 1.1:20 DEBUG STARTS: Opened browser with session id + ... LOG 1.1:20 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} From 40500b3625f3d52f7a4bb61bacb4d7179478a306 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 18:36:35 +0200 Subject: [PATCH 039/407] Drop RF 3 and PLC 2 support, remove RF 3 from CI --- .github/workflows/CI.yml | 2 +- requirements.txt | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ab1718f21..5551ec97a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [3.7, 3.9, pypy-3.7] - rf-version: [3.2.2, 4.1.3] + rf-version: [4.1.3] steps: - uses: actions/checkout@v3 diff --git a/requirements.txt b/requirements.txt index 3fe8faca6..fcf4af50e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ selenium >= 4.0.0 -robotframework >= 3.2.2 -robotframework-pythonlibcore >= 2.2.1 +robotframework >= 4.1.3 +robotframework-pythonlibcore >= 3.0.0 From 32be8e30f7a9166957e350591822d61e32d1d70e Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 20:15:59 +0200 Subject: [PATCH 040/407] Fix tests for Firefox --- .../selenium_move_to_workaround.robot | 8 ++++---- atest/acceptance/keywords/choose_file.robot | 1 + atest/acceptance/keywords/click_element.robot | 2 +- atest/acceptance/keywords/cookies.robot | 2 +- atest/acceptance/keywords/javascript.robot | 2 +- atest/acceptance/keywords/scroll_into_view.robot | 1 + atest/acceptance/keywords/textfields_html5.robot | 4 +++- atest/acceptance/keywords/waiting.robot | 4 ++-- atest/acceptance/windows.robot | 6 ++++++ 9 files changed, 20 insertions(+), 10 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot b/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot index 839afe635..1e348b3a5 100644 --- a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot +++ b/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot @@ -38,7 +38,7 @@ Click Element Double Click Element [Documentation] LOG 1 Double clicking element 'doubleClickButton'. [Setup] Initialize Page For Click Element - [Tags] Known Issue Safari Known Issue Firefox + [Tags] Known Issue Safari Double Click Element doubleClickButton Element Text Should Be output double clicked @@ -82,7 +82,7 @@ Drag and Drop Element Text Should Be id=droppable Dropped! Drag and Drop by Offset - [Tags] Known Issue Firefox Known Issue Internet Explorer Known Issue Safari + [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Go To Page "javascript/drag_and_drop.html" Element Text Should Be id=droppable Drop here Drag and Drop by Offset id=draggable ${1} ${1} @@ -256,7 +256,7 @@ Click Element Action Chain and modifier [Setup] Initialize Page For Click Element With Modifier Click Element Button modifier=CTRL action_chain=True Element Text Should Be output CTRL click - + *** Keywords *** Initialize Page For Click Element [Documentation] Initialize Page @@ -273,4 +273,4 @@ Initialize Page For Click Element With Modifier Close Popup Window Switch Window myName timeout=5s Close Window - Switch Window MAIN timeout=5s \ No newline at end of file + Switch Window MAIN timeout=5s diff --git a/atest/acceptance/keywords/choose_file.robot b/atest/acceptance/keywords/choose_file.robot index e0ab44196..b706dda55 100644 --- a/atest/acceptance/keywords/choose_file.robot +++ b/atest/acceptance/keywords/choose_file.robot @@ -18,6 +18,7 @@ Choose File And File Does Not Exist ... Choose File file_to_upload ${CURDIR}${/}NotHere.txt Choose File And Folder + [Tags] Known Issue Firefox [Setup] Go To Page "forms/file_upload_form.html" Choose File file_to_upload ${CURDIR} Textfield Value Should Be file_to_upload C:\\fakepath\\keywords diff --git a/atest/acceptance/keywords/click_element.robot b/atest/acceptance/keywords/click_element.robot index 1f3a43a2b..fa17c3564 100644 --- a/atest/acceptance/keywords/click_element.robot +++ b/atest/acceptance/keywords/click_element.robot @@ -12,7 +12,7 @@ Click Element Double Click Element [Documentation] LOG 1 Double clicking element 'doubleClickButton'. - [Tags] Known Issue Safari Known Issue Firefox + [Tags] Known Issue Safari Double Click Element doubleClickButton Element Text Should Be output double clicked diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 4dab4ef8e..5a4ab6862 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -104,7 +104,7 @@ Test Get Cookie Object Value Should Be Equal ${cookie.value} value Test Get Cookie Keyword Logging - [Tags] NoGrid + [Tags] NoGrid Known Issue Firefox [Documentation] ... LOG 1:5 ${cookie} = name=another ... value=value diff --git a/atest/acceptance/keywords/javascript.robot b/atest/acceptance/keywords/javascript.robot index 6ffc00bf7..2a2195cb2 100644 --- a/atest/acceptance/keywords/javascript.robot +++ b/atest/acceptance/keywords/javascript.robot @@ -98,7 +98,7 @@ Drag and Drop Element Text Should Be id=droppable Dropped! Drag and Drop by Offset - [Tags] Known Issue Firefox Known Issue Internet Explorer Known Issue Safari + [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Go To Page "javascript/drag_and_drop.html" Element Text Should Be id=droppable Drop here Drag and Drop by Offset id=draggable ${1} ${1} diff --git a/atest/acceptance/keywords/scroll_into_view.robot b/atest/acceptance/keywords/scroll_into_view.robot index 1170f82ae..69abdc16a 100644 --- a/atest/acceptance/keywords/scroll_into_view.robot +++ b/atest/acceptance/keywords/scroll_into_view.robot @@ -8,6 +8,7 @@ ${TEXT}= You scrolled in div. *** Test Cases *** Verify Scroll Element Into View + [Tags] Known Issue Firefox [Setup] Go To Page "scroll/index.html" ${initial_postion}= Get Vertical Position css:#target Scroll Element Into View css:#target diff --git a/atest/acceptance/keywords/textfields_html5.robot b/atest/acceptance/keywords/textfields_html5.robot index ff9747111..72ebe41ac 100644 --- a/atest/acceptance/keywords/textfields_html5.robot +++ b/atest/acceptance/keywords/textfields_html5.robot @@ -12,7 +12,7 @@ Input field type date [Documentation] Date and time formats are difficult test because format ... depends on the users machine where the test is run. Therefore only ... checking that value is not empty and it should work in most locales. - Input Text id:date 11-22-2019 + Input Text id:date 2019-11-22 ${value} = Get Value id:date Should Not Be Empty ${value} @@ -47,6 +47,7 @@ Input field type tel Should Be Equal As Strings ${value} 123 456 567 Input field type time + [Tags] Known Issue Firefox [Documentation] Date and time formats are difficult test because format ... depends on the users machine where the test is run. Therefore only ... checking that value is not empty and it should work in most locales. @@ -60,6 +61,7 @@ Input field type url Should Be Equal As Strings ${value} https://github.com/robotframework/SeleniumLibrary Input field type week + [Tags] Known Issue Firefox Input Text id:week 452019 ${value} = Get Value id:week Should Be Equal As Strings ${value} 2019-W45 diff --git a/atest/acceptance/keywords/waiting.robot b/atest/acceptance/keywords/waiting.robot index ff32f1518..d205d208b 100644 --- a/atest/acceptance/keywords/waiting.robot +++ b/atest/acceptance/keywords/waiting.robot @@ -12,7 +12,7 @@ Wait For Condition ... Wait For Condition return window.document.title == "Invalid" ${0.1} Wait For Condition Comlext Wait - [Tags] Known Issue Firefox + [Tags] Wait For Condition style = document.querySelector('#content').style; return style.background == 'red' && style.color == 'white' Wait For Condition requires `return` @@ -90,7 +90,7 @@ Wait Until Page Does Not Contain Element Limit Negative Limit Wait Until Page Does Not Contain Element Limit As Zero Wait Until Page Does Not Contain Element not_present 0.1 seconds limit=0 - + Wait Until Element Is Enabled Run Keyword And Expect Error ... Element 'id=disabled' was not enabled in 2 milliseconds. diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index 8d6a34ccb..c324c2c6d 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -88,13 +88,17 @@ Set Inner Window Size using strings Should Be Equal ${height} ${600} Get and Set Inner Window Size with Frames + [Documentation] This seems to be fine in the CI but almost always fails locally without the sleep Go To Page "frames/frameset.html" Select Frame left + Sleep 500ms Run Keyword And Expect Error ... Keyword failed setting correct window size. ... Set Window Size ${400} ${300} ${True} Get and Set Window Position + [Documentation] Headed chrome sometimes has off-by-one errors in this test, depending on the + ... desktop environment. Headless browsers and virtual displays like xvfb are fine. [Tags] Known Issue Safari Set Window Position ${300} ${200} ${x} ${y}= Get Window Position @@ -102,6 +106,8 @@ Get and Set Window Position Should Be Equal ${y} ${200} Set Window Position using strings + [Documentation] Again, headless browsers and virtual displays work fine but the x coordinate is sometimes + ... off by one and y coordinate is often broken with headed chrome, depending on desktop environment. [Tags] Known Issue Safari Set Window Position 200 100 ${x} ${y}= Get Window Position From e0559c1d3f0c636e93d2f3098cbd20201259cbea Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 20:16:58 +0200 Subject: [PATCH 041/407] Add RF 5 and 6 to CI runs --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5551ec97a..2569e3f40 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: strategy: matrix: python-version: [3.7, 3.9, pypy-3.7] - rf-version: [4.1.3] + rf-version: [4.1.3, 5.0.1, 6.0.1] steps: - uses: actions/checkout@v3 From f3319b04e14f727b2d32b8828614b40d41d2fa8c Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 20:34:11 +0200 Subject: [PATCH 042/407] Add firefox to CI runs --- .github/workflows/CI.yml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2569e3f40..bf6e02e48 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -44,24 +44,34 @@ jobs: if: matrix.python-version != 'pypy-3.7' run: | which python + - name: Run tests with headless Chrome and with PyPy if: matrix.python-version == 'pypy-3.7' run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome - - name: Run tests with headless Chrome and with Python != 3.8 - if: matrix.python-version != '3.8' && matrix.python-version != 'pypy-3.7' + + - name: Run tests with normal Chrome and with Python 3.7 + if: matrix.python-version == '3.7' run: | xvfb-run --auto-servernum python atest/run.py --zip headlesschrome - - name: Run tests normal Chrome with Python 3.8 - if: matrix.python-version == '3.8' && matrix.rf-version != '3.2.2' && matrix.python-version != 'pypy-3.7' + + - name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3 + if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3' run: | - xvfb-run --auto-servernum python atest/run.py --zip chrome + xvfb-run --auto-servernum python atest/run.py --zip headlessfirefox + + - name: Run tests with normal Firefox with Python 3.9 and RF != 4.1.3 + if: matrix.python-version == '3.9' && matrix.rf-version != '4.1.3' + run: | + xvfb-run --auto-servernum python atest/run.py --zip firefox + - name: Run tests with Selenium Grid if: matrix.python-version == '3.8' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7' run: | wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar sudo chmod u+x ./selenium-server-standalone.jar xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True + - uses: actions/upload-artifact@v1 if: success() || failure() with: From 343c84fb5f48185b72af5cae16471ba506732316 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 20:54:18 +0200 Subject: [PATCH 043/407] Add known issue firefox tags to a couple window positioning tests --- atest/acceptance/windows.robot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index c324c2c6d..733d59d16 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -98,8 +98,8 @@ Get and Set Inner Window Size with Frames Get and Set Window Position [Documentation] Headed chrome sometimes has off-by-one errors in this test, depending on the - ... desktop environment. Headless browsers and virtual displays like xvfb are fine. - [Tags] Known Issue Safari + ... desktop environment. Headless browsers are mostly fine. + [Tags] Known Issue Safari Known Issue Firefox Set Window Position ${300} ${200} ${x} ${y}= Get Window Position Should Be Equal ${x} ${300} @@ -108,7 +108,7 @@ Get and Set Window Position Set Window Position using strings [Documentation] Again, headless browsers and virtual displays work fine but the x coordinate is sometimes ... off by one and y coordinate is often broken with headed chrome, depending on desktop environment. - [Tags] Known Issue Safari + [Tags] Known Issue Safari Known Issue Firefox Set Window Position 200 100 ${x} ${y}= Get Window Position Should Be Equal ${x} ${200} From 8d95a431bcadd6b5459e9f85513599d1ba013b02 Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Thu, 22 Dec 2022 21:08:05 +0200 Subject: [PATCH 044/407] Change plain Exceptions to WebDriverExceptions in unit test --- utest/test/keywords/test_webdrivercache.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utest/test/keywords/test_webdrivercache.py b/utest/test/keywords/test_webdrivercache.py index 691221af0..f138565f2 100644 --- a/utest/test/keywords/test_webdrivercache.py +++ b/utest/test/keywords/test_webdrivercache.py @@ -2,7 +2,7 @@ from mockito import mock, verify, when, unstub from robot.utils.connectioncache import NoConnection -from selenium.common.exceptions import TimeoutException +from selenium.common.exceptions import TimeoutException, WebDriverException from SeleniumLibrary.keywords import WebDriverCache @@ -180,8 +180,8 @@ def test_close_all_cache_middle_quite_fails(self): def test_close_all_cache_all_quite_fails(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(Exception("stuff.")) - when(driver1).quit().thenRaise(Exception("stuff.")) + when(driver0).quit().thenRaise(WebDriverException("stuff.")) + when(driver1).quit().thenRaise(WebDriverException("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") cache.register(driver1, "bar1") @@ -193,7 +193,7 @@ def test_close_all_cache_all_quite_fails(self): def test_close_all_cache_not_selenium_error(self): cache = WebDriverCache() driver0, driver1, driver2 = mock(), mock(), mock() - when(driver0).quit().thenRaise(Exception("stuff.")) + when(driver0).quit().thenRaise(WebDriverException("stuff.")) when(driver1).quit().thenRaise(ValueError("stuff.")) when(driver2).quit().thenRaise(TimeoutException("timeout.")) cache.register(driver0, "bar0") From 16cc46ff8f7b1f63ff268eb0b422905f00d9bcac Mon Sep 17 00:00:00 2001 From: Lassi Heikkinen Date: Sat, 31 Dec 2022 02:05:52 +0200 Subject: [PATCH 045/407] Run tests with Chrome in job that claims to run with normal chrome --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index bf6e02e48..0ee38f2cd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -53,7 +53,7 @@ jobs: - name: Run tests with normal Chrome and with Python 3.7 if: matrix.python-version == '3.7' run: | - xvfb-run --auto-servernum python atest/run.py --zip headlesschrome + xvfb-run --auto-servernum python atest/run.py --zip chrome - name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3 if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3' From adf2c040479b97e6c5c7f45d4fe01111357876ae Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 1 Jan 2023 12:08:50 -0500 Subject: [PATCH 046/407] Removed workaround for Selenium 3 move to bug --- .../event_firing_webdriver.robot | 4 +- .../selenium_move_to_workaround.robot | 276 ------------------ atest/acceptance/keywords/click_element.robot | 2 +- .../multiple_browsers_options.robot | 24 +- atest/acceptance/open_and_close.robot | 4 +- src/SeleniumLibrary/keywords/element.py | 33 --- src/SeleniumLibrary/utils/events/event.py | 16 - 7 files changed, 17 insertions(+), 342 deletions(-) delete mode 100644 atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index be52107f4..61edab62b 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:16 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:18 INFO Got driver also from SeleniumLibrary. + ... LOG 1:15 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:17 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} diff --git a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot b/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot deleted file mode 100644 index 839afe635..000000000 --- a/atest/acceptance/2-event_firing_webdriver/selenium_move_to_workaround.robot +++ /dev/null @@ -1,276 +0,0 @@ -*** Settings *** -Documentation Can be deleted when minimum Selenium version 4.0 -Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py -Library ../../resources/testlibs/ctrl_or_command.py -Resource resource_event_firing_webdriver.robot -Force Tags NoGrid -Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} desired_capabilities=${DESIRED_CAPABILITIES} -Suite Teardown Close All Browsers - -*** Variables *** -${event_firing_or_none} ${NONE} -${CTRL_OR_COMMAND} ${EMPTY} - -*** Test Cases *** -Selenium move_to workaround Click Element At Coordinates - [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. - Click Element At Coordinates id:some_id 4 4 - -Selenium move_to workaround Scroll Element Into View - [Documentation] LOG 1:5 DEBUG Workaround for Selenium 3 bug. - Scroll Element Into View id:some_id - -Selenium move_to workaround Mouse Out - [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. - Mouse Out id:some_id - -Selenium move_to workaround Mouse Over - [Documentation] LOG 1:6 DEBUG Workaround for Selenium 3 bug. - Mouse Over id:some_id - -Click Element - [Documentation] LOG 1 Clicking element 'singleClickButton'. - [Setup] Initialize Page For Click Element - Click Element singleClickButton - Element Text Should Be output single clicked - -Double Click Element - [Documentation] LOG 1 Double clicking element 'doubleClickButton'. - [Setup] Initialize Page For Click Element - [Tags] Known Issue Safari Known Issue Firefox - Double Click Element doubleClickButton - Element Text Should Be output double clicked - -Click Element Action Chain - [Tags] NoGrid - [Documentation] - ... LOB SETUP:1 INFO Clicking 'singleClickButton' using an action chain. - ... LOG 1:7 DEBUG GLOB: *actions {"actions": [{* - [Setup] Initialize Page For Click Element - Click Element singleClickButton action_chain=True - Element Text Should Be output single clicked - -Mouse Down - [Tags] Known Issue Safari - [Setup] Go To Page "mouse/index.html" - Mouse Down el_for_mousedown - Textfield Value Should Be el_for_mousedown mousedown el_for_mousedown - Run Keyword And Expect Error - ... Element with locator 'not_there' not found. - ... Mouse Down not_there - -Mouse Up - [Tags] Known Issue Safari Known Issue Firefox - [Setup] Go To Page "mouse/index.html" - Mouse Up el_for_mouseup - Textfield Value Should Be el_for_mouseup mouseup el_for_mouseup - Run Keyword And Expect Error - ... Element with locator 'not_there' not found. - ... Mouse Up not_there - -Open Context Menu - [Tags] Known Issue Safari - [Setup] Go To Page "javascript/context_menu.html" - Open Context Menu myDiv - -Drag and Drop - [Tags] Known Issue Internet Explorer Known Issue Safari - [Setup] Go To Page "javascript/drag_and_drop.html" - Element Text Should Be id=droppable Drop here - Drag and Drop id=draggable id=droppable - Element Text Should Be id=droppable Dropped! - -Drag and Drop by Offset - [Tags] Known Issue Firefox Known Issue Internet Explorer Known Issue Safari - [Setup] Go To Page "javascript/drag_and_drop.html" - Element Text Should Be id=droppable Drop here - Drag and Drop by Offset id=draggable ${1} ${1} - Element Text Should Be id=droppable Drop here - Drag and Drop by Offset id=draggable ${100} ${20} - Element Text Should Be id=droppable Dropped! - -Mouse Down On Link - [Tags] Known Issue Safari - [Setup] Go To Page "javascript/mouse_events.html" - Mouse Down On Image image_mousedown - Text Field Should Contain textfield onmousedown - Mouse Up image_mousedown - Input text textfield ${EMPTY} - Mouse Down On Link link_mousedown - Text Field Should Contain textfield onmousedown - Mouse Up link_mousedown - -Press Keys Normal Keys - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field AAAAA - Click Button OK - Wait Until Page Contains AAAAA - -Press Keys Normal Keys Many Times - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field AAAAA+BBB - Click Button OK - Wait Until Page Contains AAAAABBB - -Press Keys Sends c++ - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field c++ - Click Button OK - Wait Until Page Contains c+ - -Press Keys Normal Keys Many Arguments - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field ccc DDDD - Click Button OK - Wait Until Page Contains cccDDDD - -Press Keys Normal Keys Many Times With Many Args - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field a+b C+D - Click Button OK - Wait Until Page Contains abCD - -Press Keys Special Keys SHIFT - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field SHIFT+cc - Click Button OK - Wait Until Page Contains CC - -Press Keys Special Keys SHIFT Many Times - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field SHIFT+cc SHIFT+dd - Click Button OK - Wait Until Page Contains CCDD timeout=3 - -Press Keys To Multiple Elements - [Documentation] The | Press Keys | OK | ENTER | presses OK button two times, because - ... Selenium sets the focus to element by clicking the element. - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field tidii - Press Keys OK ENTER - Press Keys None ENTER ENTER - Wait Until Page Contains tidii timeout=3 - Page Should Contain Element //p[text()="tidii"] limit=4 - -Press Keys ASCII Code Send As Is - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field \\108 \\13 - Click Button OK - Wait Until Page Contains \\108\\13 timeout=3 - -Press Keys With Scandic Letters - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field ÖÄÖÄÖ ÅÖÄP - Click Button OK - Wait Until Page Contains ÖÄÖÄÖÅÖÄP timeout=3 - -Press Keys With Asian Text - [Setup] Go To Page "forms/input_special_keys.html" - Press Keys text_field 田中さんにあげ+て下 さい - Click Button OK - Wait Until Page Contains 田中さんにあげて下さい timeout=3 - -Press Keys Element Not Found - [Setup] Go To Page "forms/input_special_keys.html" - Run Keyword And Expect Error - ... Element with locator 'not_here' not found. - ... Press Keys not_here YYYY - -Press Keys No keys Argument - [Setup] Go To Page "forms/input_special_keys.html" - Run Keyword And Expect Error - ... "keys" argument can not be empty. - ... Press Keys text_field - -Press Keys Without Element - [Setup] Go To Page "forms/input_special_keys.html" - Click Element text_field - Press Keys None tidii - Click Button OK - Wait Until Page Contains tidii timeout=3 - -Press Keys Multiple Times Without Element - [Setup] Go To Page "forms/input_special_keys.html" - Click Element text_field - Press Keys None foo+bar e+n+d - Click Button OK - Wait Until Page Contains foobarend timeout=3 - -Press Keys Without Element Special Keys - [Setup] Go To Page "forms/input_special_keys.html" - Click Element text_field - Press Keys None ${CTRL_OR_COMMAND}+A ${CTRL_OR_COMMAND}+v - Click Button OK - Wait Until Page Contains Please input text and click the button. Text will appear in the page. timeout=3 - -Click Element Modifier CTRL - [Setup] Initialize Page For Click Element With Modifier - Click Element Button modifier=CTRL - Element Text Should Be output CTRL click - -Click Link Modifier CTRL - [Setup] Initialize Page For Click Element With Modifier - Click Link link text modifier=CTRL - Element Text Should Be output CTRL click - [Teardown] Close Popup Window - -Click Button Modifier CTRL - [Setup] Initialize Page For Click Element With Modifier - Click Button Click me! modifier=CTRL - Element Text Should Be output CTRL click - -Click Image Modifier CTRL - [Setup] Initialize Page For Click Element With Modifier - Click Image robot modifier=CTRL - Element Text Should Be output CTRL click - -Click Element Modifier ALT - [Setup] Initialize Page For Click Element With Modifier - Click Element Button alt - Element Text Should Be output ALT click - -Click Element Modifier Shift - [Setup] Initialize Page For Click Element With Modifier - Click Element Button Shift - Element Text Should Be output Shift click - -Click Element Modifier CTRL+Shift - [Setup] Initialize Page For Click Element With Modifier - Click Element Button modifier=CTRL+Shift - Element Text Should Be output CTRL and Shift click - -Click Element No Modifier - [Setup] Initialize Page For Click Element With Modifier - Click Element Button modifier=False - Element Text Should Be output Normal click - -Click Element Wrong Modifier - [Setup] Initialize Page For Click Element With Modifier - Run Keyword And Expect Error - ... ValueError: 'FOOBAR' modifier does not match to Selenium Keys - ... Click Element Button Foobar - -Click Element Action Chain and modifier - [Documentation] LOG 1:1 INFO Clicking element 'Button' with CTRL. - [Setup] Initialize Page For Click Element With Modifier - Click Element Button modifier=CTRL action_chain=True - Element Text Should Be output CTRL click - -*** Keywords *** -Initialize Page For Click Element - [Documentation] Initialize Page - Go To Page "javascript/click.html" - Reload Page - Element Text Should Be output initial output - -Initialize Page For Click Element With Modifier - [Documentation] Initialize Page - Go To Page "javascript/click_modifier.html" - Reload Page - Element Text Should Be output initial output - -Close Popup Window - Switch Window myName timeout=5s - Close Window - Switch Window MAIN timeout=5s \ No newline at end of file diff --git a/atest/acceptance/keywords/click_element.robot b/atest/acceptance/keywords/click_element.robot index 1f3a43a2b..2466a181b 100644 --- a/atest/acceptance/keywords/click_element.robot +++ b/atest/acceptance/keywords/click_element.robot @@ -40,7 +40,7 @@ Click Element Action Chain [Tags] NoGrid [Documentation] ... LOB 1:1 INFO Clicking 'singleClickButton' using an action chain. - ... LOG 1:7 DEBUG GLOB: *actions {"actions": [{* + ... LOG 1:6 DEBUG GLOB: *actions {"actions": [{* Click Element singleClickButton action_chain=True Element Text Should Be output single clicked diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index b369bed06..e0cfaf654 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With Selenium Options As String [Documentation] - ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] - ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:3 DEBUG GLOB: *"--headless"* + ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:2 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid [Documentation] - ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* - ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:2 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* + ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) Chrome Browser With Selenium Options Object [Documentation] - ... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 2:2 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 2:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} @@ -47,7 +47,7 @@ Chrome Browser With Selenium Options Invalid Method Chrome Browser With Selenium Options Argument With Semicolon [Documentation] - ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* + ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:2 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 7267c570d..991b8eb71 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened Browser Open With Not Well-Formed URL Should Close [Documentation] Verify after incomplete 'Open Browser' browser closes - ... LOG 1.1:20 DEBUG STARTS: Opened browser with session id - ... LOG 1.1:20 DEBUG REGEXP: .*but failed to open url.* + ... LOG 1.1:19 DEBUG STARTS: Opened browser with session id + ... LOG 1.1:19 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 51e3710cc..bd63cd13f 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -17,7 +17,6 @@ from typing import List, Optional, Tuple, Union from SeleniumLibrary.utils import is_noney -from SeleniumLibrary.utils.events.event import _unwrap_eventfiring_element from robot.utils import plural_or_not, is_truthy from selenium.webdriver.common.action_chains import ActionChains from selenium.webdriver.common.keys import Keys @@ -661,8 +660,6 @@ def _click_with_action_chain(self, locator: Union[WebElement, str]): self.info(f"Clicking '{locator}' using an action chain.") action = ActionChains(self.driver) element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action.move_to_element(element) action.click() action.perform() @@ -678,8 +675,6 @@ def _click_with_modifier(self, locator, tag, modifier): element = self.find_element(locator, tag=tag[0], required=False) if not element: element = self.find_element(locator, tag=tag[1]) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action.click(element) for item in modifier: action.key_up(item) @@ -701,8 +696,6 @@ def click_element_at_coordinates( f"Clicking element '{locator}' at coordinates x={xoffset}, y={yoffset}." ) element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.move_to_element(element) action.move_by_offset(xoffset, yoffset) @@ -718,8 +711,6 @@ def double_click_element(self, locator: Union[WebElement, str]): """ self.info(f"Double clicking element '{locator}'.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.double_click(element).perform() @@ -745,8 +736,6 @@ def scroll_element_into_view(self, locator: Union[WebElement, str]): New in SeleniumLibrary 3.2.0 """ element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) ActionChains(self.driver).move_to_element(element).perform() @keyword @@ -763,11 +752,7 @@ def drag_and_drop( | `Drag And Drop` | css:div#element | css:div.target | """ element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) target = self.find_element(target) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - target = _unwrap_eventfiring_element(target) action = ActionChains(self.driver) action.drag_and_drop(element, target).perform() @@ -787,8 +772,6 @@ def drag_and_drop_by_offset( | `Drag And Drop By Offset` | myElem | 50 | -35 | # Move myElem 50px right and 35px down | """ element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.drag_and_drop_by_offset(element, xoffset, yoffset) action.perform() @@ -807,8 +790,6 @@ def mouse_down(self, locator: Union[WebElement, str]): """ self.info(f"Simulating Mouse Down on element '{locator}'.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.click_and_hold(element).perform() @@ -821,8 +802,6 @@ def mouse_out(self, locator: Union[WebElement, str]): """ self.info(f"Simulating Mouse Out on element '{locator}'.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) size = element.size offsetx = (size["width"] / 2) + 1 offsety = (size["height"] / 2) + 1 @@ -840,8 +819,6 @@ def mouse_over(self, locator: Union[WebElement, str]): """ self.info(f"Simulating Mouse Over on element '{locator}'.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.move_to_element(element).perform() @@ -854,16 +831,12 @@ def mouse_up(self, locator: Union[WebElement, str]): """ self.info(f"Simulating Mouse Up on element '{locator}'.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) ActionChains(self.driver).release(element).perform() @keyword def open_context_menu(self, locator: Union[WebElement, str]): """Opens the context menu on the element identified by ``locator``.""" element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.context_click(element).perform() @@ -952,8 +925,6 @@ def press_keys(self, locator: Union[WebElement, None, str] = None, *keys: str): if not is_noney(locator): self.info(f"Sending key(s) {keys} to {locator} element.") element = self.find_element(locator) - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) ActionChains(self.driver).click(element).perform() else: self.info(f"Sending key(s) {keys} to page.") @@ -1007,8 +978,6 @@ def mouse_down_on_link(self, locator: Union[WebElement, str]): using ``id``, ``name``, ``href`` and the link text. """ element = self.find_element(locator, tag="link") - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.click_and_hold(element).perform() @@ -1057,8 +1026,6 @@ def mouse_down_on_image(self, locator: Union[WebElement, str]): using ``id``, ``name``, ``src`` and ``alt``. """ element = self.find_element(locator, tag="image") - # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. - element = _unwrap_eventfiring_element(element) action = ActionChains(self.driver) action.click_and_hold(element).perform() diff --git a/src/SeleniumLibrary/utils/events/event.py b/src/SeleniumLibrary/utils/events/event.py index a190c702a..711ea7af4 100644 --- a/src/SeleniumLibrary/utils/events/event.py +++ b/src/SeleniumLibrary/utils/events/event.py @@ -25,22 +25,6 @@ def trigger(self, *args, **kwargs): pass -def _unwrap_eventfiring_element(element): - """Workaround for Selenium 3 bug. - - References: - https://github.com/SeleniumHQ/selenium/issues/7877 - https://github.com/SeleniumHQ/selenium/pull/8348 - https://github.com/SeleniumHQ/selenium/issues/7467 - https://github.com/SeleniumHQ/selenium/issues/6604 - - """ - logger.debug("Workaround for Selenium 3 bug.") - if not isinstance(element, EventFiringWebElement) or selenium_major_version() >= 4: - return element - return element.wrapped_element - - def selenium_major_version(): import selenium From e6ce9b8d4f08080a01d96df91a1bd25e6677973f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 1 Jan 2023 14:30:16 -0500 Subject: [PATCH 047/407] Readjusted expected log messages --- .../event_firing_webdriver.robot | 4 ++-- .../multiple_browsers_options.robot | 24 +++++++++---------- atest/acceptance/open_and_close.robot | 4 ++-- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 61edab62b..be52107f4 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:15 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:17 INFO Got driver also from SeleniumLibrary. + ... LOG 1:16 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:18 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index e0cfaf654..b369bed06 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With Selenium Options As String [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:2 DEBUG GLOB: *"--headless"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* - ... LOG 1:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* + ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) Chrome Browser With Selenium Options Object [Documentation] - ... LOG 2:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 2:2 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 2:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 2:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} @@ -47,7 +47,7 @@ Chrome Browser With Selenium Options Invalid Method Chrome Browser With Selenium Options Argument With Semicolon [Documentation] - ... LOG 1:2 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:2 DEBUG GLOB: *["has;semicolon"* + ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* + ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 991b8eb71..7267c570d 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened Browser Open With Not Well-Formed URL Should Close [Documentation] Verify after incomplete 'Open Browser' browser closes - ... LOG 1.1:19 DEBUG STARTS: Opened browser with session id - ... LOG 1.1:19 DEBUG REGEXP: .*but failed to open url.* + ... LOG 1.1:20 DEBUG STARTS: Opened browser with session id + ... LOG 1.1:20 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} From a79b35df7f480706f8564681e77b0f5a5af1a82f Mon Sep 17 00:00:00 2001 From: Jani Mikkonen Date: Thu, 19 Jan 2023 13:50:20 +0200 Subject: [PATCH 048/407] Users can now modify ActionChains() duration. Fixes #1768 Now includes utest for setter/getter and test that correct delay is passed to ActionChains() constructor --- src/SeleniumLibrary/__init__.py | 6 +++- src/SeleniumLibrary/__init__.pyi | 2 +- .../keywords/browsermanagement.py | 24 +++++++++++++- src/SeleniumLibrary/keywords/element.py | 32 +++++++++---------- src/SeleniumLibrary/utils/__init__.py | 1 + src/SeleniumLibrary/utils/types.py | 7 ++++ ...on.test_parse_plugin_init_doc.approved.txt | 2 ++ utest/test/api/test_plugins.py | 2 +- utest/test/keywords/test_browsermanagement.py | 19 +++++++++++ .../test_keyword_arguments_element.py | 22 +++++++++++-- 10 files changed, 95 insertions(+), 22 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 2a469a222..2e2bbd942 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -48,7 +48,7 @@ ) from SeleniumLibrary.keywords.screenshot import EMBED from SeleniumLibrary.locators import ElementFinder -from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout +from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay __version__ = "6.1.0.dev1" @@ -431,6 +431,7 @@ def __init__( self, timeout=timedelta(seconds=5), implicit_wait=timedelta(seconds=0), + action_chain_delay=timedelta(seconds=0.25), run_on_failure="Capture Page Screenshot", screenshot_root_directory: Optional[str] = None, plugins: Optional[str] = None, @@ -442,6 +443,8 @@ def __init__( Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. + - ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -456,6 +459,7 @@ def __init__( """ self.timeout = _convert_timeout(timeout) self.implicit_wait = _convert_timeout(implicit_wait) + self.action_chain_delay = _convert_delay(action_chain_delay) self.speed = 0.0 self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( run_on_failure diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index 170390580..cf36fe8c5 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -6,7 +6,7 @@ from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver.remote.webelement import WebElement class SeleniumLibrary: - def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Union[str, None]] = None, plugins: Optional[Union[str, None]] = None, event_firing_webdriver: Optional[Union[str, None]] = None): ... + def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), action_chain_delay(seconds=0.25)), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Union[str, None]] = None, plugins: Optional[Union[str, None]] = None, event_firing_webdriver: Optional[Union[str, None]] = None): ... def add_cookie(self, name: str, value: str, path: Optional[Union[str, None]] = None, domain: Optional[Union[str, None]] = None, secure: Optional[Union[bool, None]] = None, expiry: Optional[Union[str, None]] = None): ... def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Union[datetime.timedelta, None]] = None): ... diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index f52ed23c4..095a17af9 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -25,7 +25,7 @@ from SeleniumLibrary.base import keyword, LibraryComponent from SeleniumLibrary.locators import WindowManager -from SeleniumLibrary.utils import secs_to_timestr, _convert_timeout +from SeleniumLibrary.utils import timestr_to_secs, secs_to_timestr, _convert_timeout, _convert_delay from .webdrivertools import WebDriverCreator @@ -692,6 +692,28 @@ def set_selenium_implicit_wait(self, value: timedelta) -> str: driver.implicitly_wait(self.ctx.implicit_wait) return old_wait + @keyword + def set_action_chain_delay(self, value: timedelta) -> str: + """Sets the duration of delay in ActionChains() used by SeleniumLibrary. + + The value can be given as a number that is considered to be + seconds or as a human-readable string like ``1 second``. + + Value is always stored as milliseconds internally. + + The previous value is returned and can be used to restore + the original value later if needed. + """ + old_action_chain_delay = self.ctx.action_chain_delay + self.ctx.action_chain_delay = _convert_delay(value) + return timestr_to_secs(f"{old_action_chain_delay} milliseconds") + + @keyword + def get_action_chain_delay(self): + """Gets the currently stored value for chain_delay_value in timestr format. + """ + return timestr_to_secs(f"{self.ctx.action_chain_delay} milliseconds") + @keyword def set_browser_implicit_wait(self, value: timedelta): """Sets the implicit wait value used by Selenium. diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 51e3710cc..e799419ad 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -659,7 +659,7 @@ def click_element( def _click_with_action_chain(self, locator: Union[WebElement, str]): self.info(f"Clicking '{locator}' using an action chain.") - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) @@ -672,7 +672,7 @@ def _click_with_modifier(self, locator, tag, modifier): f"Clicking {tag if tag[0] else 'element'} '{locator}' with {modifier}." ) modifier = self.parse_modifier(modifier) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) for item in modifier: action.key_down(item) element = self.find_element(locator, tag=tag[0], required=False) @@ -703,7 +703,7 @@ def click_element_at_coordinates( element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.move_to_element(element) action.move_by_offset(xoffset, yoffset) action.click() @@ -720,7 +720,7 @@ def double_click_element(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.double_click(element).perform() @keyword @@ -747,7 +747,7 @@ def scroll_element_into_view(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - ActionChains(self.driver).move_to_element(element).perform() + ActionChains(self.driver, duration=self.ctx.action_chain_delay).move_to_element(element).perform() @keyword def drag_and_drop( @@ -768,7 +768,7 @@ def drag_and_drop( target = self.find_element(target) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. target = _unwrap_eventfiring_element(target) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.drag_and_drop(element, target).perform() @keyword @@ -789,7 +789,7 @@ def drag_and_drop_by_offset( element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.drag_and_drop_by_offset(element, xoffset, yoffset) action.perform() @@ -809,7 +809,7 @@ def mouse_down(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.click_and_hold(element).perform() @keyword @@ -826,7 +826,7 @@ def mouse_out(self, locator: Union[WebElement, str]): size = element.size offsetx = (size["width"] / 2) + 1 offsety = (size["height"] / 2) + 1 - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.move_to_element(element) action.move_by_offset(offsetx, offsety) action.perform() @@ -842,7 +842,7 @@ def mouse_over(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.move_to_element(element).perform() @keyword @@ -856,7 +856,7 @@ def mouse_up(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - ActionChains(self.driver).release(element).perform() + ActionChains(self.driver, duration=self.ctx.action_chain_delay).release(element).perform() @keyword def open_context_menu(self, locator: Union[WebElement, str]): @@ -864,7 +864,7 @@ def open_context_menu(self, locator: Union[WebElement, str]): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.context_click(element).perform() @keyword @@ -954,12 +954,12 @@ def press_keys(self, locator: Union[WebElement, None, str] = None, *keys: str): element = self.find_element(locator) # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - ActionChains(self.driver).click(element).perform() + ActionChains(self.driver, duration=self.ctx.action_chain_delay).click(element).perform() else: self.info(f"Sending key(s) {keys} to page.") element = None for parsed_key in parsed_keys: - actions = ActionChains(self.driver) + actions = ActionChains(self.driver, duration=self.ctx.action_chain_delay) for key in parsed_key: if key.special: self._press_keys_special_keys(actions, element, parsed_key, key) @@ -1009,7 +1009,7 @@ def mouse_down_on_link(self, locator: Union[WebElement, str]): element = self.find_element(locator, tag="link") # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.click_and_hold(element).perform() @keyword @@ -1059,7 +1059,7 @@ def mouse_down_on_image(self, locator: Union[WebElement, str]): element = self.find_element(locator, tag="image") # _unwrap_eventfiring_element can be removed when minimum required Selenium is 4.0 or greater. element = _unwrap_eventfiring_element(element) - action = ActionChains(self.driver) + action = ActionChains(self.driver, duration=self.ctx.action_chain_delay) action.click_and_hold(element).perform() @keyword diff --git a/src/SeleniumLibrary/utils/__init__.py b/src/SeleniumLibrary/utils/__init__.py index b03074682..ccc4df2c6 100644 --- a/src/SeleniumLibrary/utils/__init__.py +++ b/src/SeleniumLibrary/utils/__init__.py @@ -24,6 +24,7 @@ is_truthy, WINDOWS, _convert_timeout, + _convert_delay, ) # noqa diff --git a/src/SeleniumLibrary/utils/types.py b/src/SeleniumLibrary/utils/types.py index 4f000f44e..82a94ada5 100644 --- a/src/SeleniumLibrary/utils/types.py +++ b/src/SeleniumLibrary/utils/types.py @@ -28,6 +28,13 @@ def is_noney(item): return item is None or is_string(item) and item.upper() == "NONE" +def _convert_delay(delay): + if isinstance(delay, timedelta): + return delay.microseconds // 1000 + else: + x = timestr_to_secs(delay) + return int( x * 1000) + def _convert_timeout(timeout): if isinstance(timeout, timedelta): diff --git a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt index 5c8d629d2..76d999554 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt @@ -4,6 +4,8 @@ SeleniumLibrary can be imported with several optional arguments. Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. +- ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 7218e637b..2c35e3c40 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 173) + self.assertEqual(len(sl.get_keyword_names()), 175) def test_parse_library(self): plugin = "path.to.MyLibrary" diff --git a/utest/test/keywords/test_browsermanagement.py b/utest/test/keywords/test_browsermanagement.py index f3e67b576..33bb9c17f 100644 --- a/utest/test/keywords/test_browsermanagement.py +++ b/utest/test/keywords/test_browsermanagement.py @@ -23,6 +23,25 @@ def test_set_selenium_timeout_only_affects_open_browsers(): verifyNoMoreInteractions(second_browser) +def test_action_chain_delay_default(): + sl = SeleniumLibrary() + assert sl.action_chain_delay == 250, f"Delay should have 250" + + +def test_set_action_chain_delay_default(): + sl = SeleniumLibrary() + sl.set_action_chain_delay("3.0") + assert sl.action_chain_delay == 3000, f"Delay should have 3000" + + sl.set_action_chain_delay("258 milliseconds") + assert sl.action_chain_delay == 258, f"Delay should have 258" + + +def test_get_action_chain_delay_default(): + sl = SeleniumLibrary() + sl.set_action_chain_delay("300 milliseconds") + assert sl.get_action_chain_delay() == 0.3 + def test_selenium_implicit_wait_default(): sl = SeleniumLibrary() assert sl.implicit_wait == 0.0, "Wait should have 0.0" diff --git a/utest/test/keywords/test_keyword_arguments_element.py b/utest/test/keywords/test_keyword_arguments_element.py index c5223afd1..c35b402ec 100644 --- a/utest/test/keywords/test_keyword_arguments_element.py +++ b/utest/test/keywords/test_keyword_arguments_element.py @@ -1,13 +1,14 @@ import pytest -from mockito import mock, unstub, when - +from mockito import mock, unstub, when, matchers from SeleniumLibrary.keywords import ElementKeywords +import SeleniumLibrary.keywords.element as SUT @pytest.fixture(scope="function") def element(): ctx = mock() ctx._browser = mock() + ctx.action_chain_delay = 251 return ElementKeywords(ctx) @@ -27,3 +28,20 @@ def test_element_text_should_be(element): with pytest.raises(AssertionError) as error: element.element_text_should_be(locator, "not text", "foobar") assert "foobar" in str(error.value) + + + +def test_action_chain_delay_in_elements(element): + locator = "//div" + webelement = mock() + when(element).find_element(locator).thenReturn(webelement) + + chain_mock = mock() + expected_delay_in_ms = 1000 + element.ctx.action_chain_delay = expected_delay_in_ms + when(chain_mock).move_to_element(matchers.ANY).thenReturn(mock()) + when(SUT).ActionChains(matchers.ANY, duration=expected_delay_in_ms).thenReturn(chain_mock) + element.scroll_element_into_view(locator) + + + From 6faa10210be5e510764b785e167e21de45dc89b4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Feb 2023 23:25:23 -0500 Subject: [PATCH 049/407] Added some more Page Should Contain tests verifing custom loglevel In verifying the documentation on the `Page Should Contain` keyword, as outlined in issue #1785, I've added a few addition tests which check out when the custom log level is set to INFO, WARN, NONE and a level below the current log level. These test verify the general rules laid out in the keyword documentation. What I am currently questioning is the default value of the loglevel argument and whther or not it is actually None and INFO which the documentation says it is nor TRACE which is what the code seems to have as a default. This last piece is what is nost baffling as it does indeed look like the default value is TRACE. --- .../keywords/content_assertions.robot | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index 03559fe17..20252cf9b 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -37,6 +37,22 @@ Page Should Contain With Text Having Internal Elements Go to page "links.html" Page Should Contain Relative with text after +Page Should Contain With Custom Log Level INFO + [Tags] NoGrid + [Documentation] Html content is shown at INFO level. + ... FAIL Page should have contained text 'non existing text' but did not. + ... LOG 1:18 INFO REGEXP: (?i) + ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. + Page Should Contain non existing text INFO + +Page Should Contain With Custom Log Level WARN + [Tags] NoGrid + [Documentation] Html content is shown at WARN level. + ... FAIL Page should have contained text 'non existing text' but did not. + ... LOG 1:18 WARN REGEXP: (?i) + ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. + Page Should Contain non existing text WARN + Page Should Contain With Custom Log Level DEBUG [Tags] NoGrid [Documentation] Html content is shown at DEBUG level. @@ -47,7 +63,7 @@ Page Should Contain With Custom Log Level DEBUG Page Should Contain With Custom Log Level TRACE [Tags] NoGrid - [Documentation] Html content is shown at DEBUG level. + [Documentation] Html content is shown at TRACE level. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 2:19 TRACE REGEXP: (?i) ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. @@ -55,6 +71,22 @@ Page Should Contain With Custom Log Level TRACE Page Should Contain non existing text TRACE [Teardown] Set Log Level DEBUG +Page Should Contain With Custom Log Level NONE + [Tags] NoGrid + [Documentation] Html content is not shown at NONE level. + ... FAIL Page should have contained text 'non existing text' but did not. + ... LOG 1:18 FAIL Page should have contained text 'non existing text' but did not. + Page Should Contain non existing text NONE + +Page Should Contain With Custom Log Level Below Current Log Level + [Tags] NoGrid + [Documentation] Html content is not shown when custom log level is below curent log level. + ... FAIL Page should have contained text 'non existing text' but did not. + ... LOG 2:18 FAIL Page should have contained text 'non existing text' but did not. + ${old_level}= Set Log Level DEBUG + Page Should Contain non existing text TRACE + [Teardown] Set Log Level ${old_level} + Page Should Contain With Disabling Source Logging [Documentation] LOG TEARDOWN:2 NONE Set Log Level INFO From 4b716d9a24bbb60748563a289cf8f12dfefaac92 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Feb 2023 23:48:25 -0500 Subject: [PATCH 050/407] Added another Page Should Contain test to prove default custom loglevel Added `Page Should Contain Using Default Custom Log Level` as a means to test out the default log level and that the html code should be printed out at that level. The original `Page Should Contain` test case (yes, a test case whcih has the same name as the keyword) as written now does not print out the html. Apparently this test suite is running at a log level of DEBUG. And thus with a default custom log level of TRACE no html should be printed. But if one set the log level to TRACE, as this added test case does, and leave the custom log level to its default value, this proves that default is TRACE. --- atest/acceptance/keywords/content_assertions.robot | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index 20252cf9b..6cdc548a0 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -27,6 +27,16 @@ Page Should Contain Page Should Contain This is the haystack Page Should Contain non existing text +Page Should Contain Using Default Custom Log Level + [Tags] NoGrid + [Documentation] The Page Should Contains using default custom log level fails and the log contains the html content. + ... FAIL Page should have contained text 'non existing text' but did not. + ... LOG 2:19 TRACE REGEXP: (?i) + ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. + ${old_level}= Set Log Level TRACE + Page Should Contain non existing text + [Teardown] Set Log Level ${old_level} + Page Should Contain Numbers And String Should Be Same Log Source Page Should Contain 1 From 7c89623b42f7e40ee939cbd3e2b3401221bc4556 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Feb 2023 23:58:35 -0500 Subject: [PATCH 051/407] Corrected `Page Should Contain` keyword documentation Corrected the default value for the custom log level is `TRACE` and not, as previously stated, `INFO`. --- src/SeleniumLibrary/keywords/element.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 51e3710cc..edc938954 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -130,9 +130,9 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"): If this keyword fails, it automatically logs the page source using the log level specified with the optional ``loglevel`` - argument. Valid log levels are ``DEBUG``, ``INFO`` (default), - ``WARN``, and ``NONE``. If the log level is ``NONE`` or below - the current active log level the source will not be logged. + argument. Valid log levels are ``TRACE`` (default), ``DEBUG``, + ``INFO``, ``WARN``, and ``NONE``. If the log level is ``NONE`` + or below the current active log level the source will not be logged. """ if not self._page_contains(text): self.ctx.log_source(loglevel) From f5cfdcf096de08cf13c525295622460f64a3550a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 19 Feb 2023 12:23:21 -0500 Subject: [PATCH 052/407] Updated `Test Get Cookie Keyword Logging` with Samesite attribute Updated expected result to include the samesite cookie attribute. For more information about this attribute see, https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite It is unclear why the cookie response now includes this. As noted in the reference above this may be browser dependent. --- atest/acceptance/keywords/cookies.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 5a4ab6862..a457842e5 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -113,6 +113,7 @@ Test Get Cookie Keyword Logging ... secure=False ... httpOnly=False ... expiry=2023-10-29 19:36:51 + ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie another *** Keyword *** From 27e06024cd75c18f2a93bfe31bcc4f29da761c26 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 29 Mar 2023 13:29:17 -0400 Subject: [PATCH 053/407] Updated atest documentation for logging html under Page Should Contain tests --- atest/acceptance/keywords/content_assertions.robot | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index 6cdc548a0..a9f53ec70 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -29,7 +29,9 @@ Page Should Contain Page Should Contain Using Default Custom Log Level [Tags] NoGrid - [Documentation] The Page Should Contains using default custom log level fails and the log contains the html content. + [Documentation] The Page Should Contains using default custom log level (that being + ... 'TRACE' - noting the excluded second argument for the `Page Should Contain` + ... keyword) fails and the log contains the html content. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 2:19 TRACE REGEXP: (?i) ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. @@ -49,7 +51,7 @@ Page Should Contain With Text Having Internal Elements Page Should Contain With Custom Log Level INFO [Tags] NoGrid - [Documentation] Html content is shown at INFO level. + [Documentation] Html content is shown at the explicitly specified INFO level. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 1:18 INFO REGEXP: (?i) ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. @@ -57,7 +59,7 @@ Page Should Contain With Custom Log Level INFO Page Should Contain With Custom Log Level WARN [Tags] NoGrid - [Documentation] Html content is shown at WARN level. + [Documentation] Html content is shown at the explicitly specified WARN level. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 1:18 WARN REGEXP: (?i) ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. @@ -65,7 +67,7 @@ Page Should Contain With Custom Log Level WARN Page Should Contain With Custom Log Level DEBUG [Tags] NoGrid - [Documentation] Html content is shown at DEBUG level. + [Documentation] Html content is shown at the explicitly specified DEBUG level. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 1:18 DEBUG REGEXP: (?i) ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. @@ -73,7 +75,7 @@ Page Should Contain With Custom Log Level DEBUG Page Should Contain With Custom Log Level TRACE [Tags] NoGrid - [Documentation] Html content is shown at TRACE level. + [Documentation] Html content is shown at the explicitly specified TRACE level. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 2:19 TRACE REGEXP: (?i) ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. @@ -83,7 +85,7 @@ Page Should Contain With Custom Log Level TRACE Page Should Contain With Custom Log Level NONE [Tags] NoGrid - [Documentation] Html content is not shown at NONE level. + [Documentation] Html content is not shown because the loglevel is set to NONE. ... FAIL Page should have contained text 'non existing text' but did not. ... LOG 1:18 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain non existing text NONE From 37b29d18c291642c10801fa4fda4b0e3192a4b34 Mon Sep 17 00:00:00 2001 From: Robin Matz Date: Mon, 6 Dec 2021 21:36:46 +0100 Subject: [PATCH 054/407] add api to set page load timeout --- .../event_firing_webdriver.robot | 4 +- atest/acceptance/open_and_close.robot | 4 +- docs/extending/extending.rst | 7 ++-- src/SeleniumLibrary/__init__.py | 15 +++++++ .../keywords/browsermanagement.py | 42 +++++++++++++++++++ ...cumentation.test_many_plugins.approved.txt | 11 +++++ ...on.test_parse_plugin_init_doc.approved.txt | 2 + utest/test/api/test_plugins.py | 2 +- utest/test/keywords/test_browsermanagement.py | 28 +++++++++++++ 9 files changed, 107 insertions(+), 8 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index be52107f4..1392f2bbf 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -12,8 +12,8 @@ ${event_firing_or_none} ${NONE} Open Browser To Start Page [Tags] NoGrid [Documentation] - ... LOG 1:16 DEBUG Wrapping driver to event_firing_webdriver. - ... LOG 1:18 INFO Got driver also from SeleniumLibrary. + ... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver. + ... LOG 1:22 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 7267c570d..5efd2d0d2 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -16,8 +16,8 @@ Close Browser Does Nothing When No Browser Is Opened Browser Open With Not Well-Formed URL Should Close [Documentation] Verify after incomplete 'Open Browser' browser closes - ... LOG 1.1:20 DEBUG STARTS: Opened browser with session id - ... LOG 1.1:20 DEBUG REGEXP: .*but failed to open url.* + ... LOG 1.1:24 DEBUG STARTS: Opened browser with session id + ... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} diff --git a/docs/extending/extending.rst b/docs/extending/extending.rst index c6dfa894d..7f33d4f6d 100644 --- a/docs/extending/extending.rst +++ b/docs/extending/extending.rst @@ -73,16 +73,17 @@ failure_occurred Method that is executed when a SeleniumLibrary keyword fails. Also there are the following public attributes available: -========================= ================================================================ +========================= ====================================================================== Attribute Description -========================= ================================================================ +========================= ====================================================================== driver Current active driver. event_firing_webdriver Reference to a class implementing event firing selenium support. timeout Default value for ``timeouts`` used with ``Wait ...`` keywords. +page_load_timeout Default value to wait for page load to complete until error is raised. implicit_wait Default value for ``implicit wait`` used when locating elements. run_on_failure_keyword Default action for the `run-on-failure functionality`. screenshot_root_directory Location where possible screenshots are created -========================= ================================================================ +========================= ====================================================================== For more details about the methods, please read the individual method documentation and many of the attributes are explained in the library `keyword documentation`_. please note that diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 2a469a222..58cb31c8f 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -355,6 +355,17 @@ class SeleniumLibrary(DynamicCore): See `time format` below for supported syntax. + == Page load == + Page load timeout is the amount of time to wait for page load to complete until error is raised. + + The default page load timeout can be set globally + when `importing` the library with the ``page_load_timeout`` argument + or by using the `Set Selenium Page Load Timeout` keyword. + + See `time format` below for supported timeout syntax. + + Support for page load is new in SeleniumLibrary 6.1 + == Selenium speed == Selenium execution speed can be slowed down globally by using `Set @@ -431,6 +442,7 @@ def __init__( self, timeout=timedelta(seconds=5), implicit_wait=timedelta(seconds=0), + page_load_timeout=timedelta(seconds=10), run_on_failure="Capture Page Screenshot", screenshot_root_directory: Optional[str] = None, plugins: Optional[str] = None, @@ -442,6 +454,8 @@ def __init__( Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. + - ``page_load_timeout``: + Default value to wait for page load to complete until error is raised. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -456,6 +470,7 @@ def __init__( """ self.timeout = _convert_timeout(timeout) self.implicit_wait = _convert_timeout(implicit_wait) + self.page_load_timeout = _convert_timeout(page_load_timeout) self.speed = 0.0 self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( run_on_failure diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index f52ed23c4..ba8f65c87 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -624,6 +624,19 @@ def get_selenium_implicit_wait(self) -> str: """ return secs_to_timestr(self.ctx.implicit_wait) + @keyword + def get_selenium_page_load_timeout(self) -> str: + """Gets the timeout to wait for a page load to complete + before throwing an error. + + The value is returned as a human-readable string like ``1 second``. + + See the `Page load` section above for more information. + + New in SeleniumLibrary 6.1 + """ + return secs_to_timestr(self.ctx.page_load_timeout) + @keyword def set_selenium_speed(self, value: timedelta) -> str: """Sets the delay that is waited after each Selenium command. @@ -701,6 +714,34 @@ def set_browser_implicit_wait(self, value: timedelta): """ self.driver.implicitly_wait(_convert_timeout(value)) + @keyword + def set_selenium_page_load_timeout(self, value: timedelta) -> str: + """Sets the page load timeout value used by Selenium. + + The value can be given as a number that is considered to be + seconds or as a human-readable string like ``1 second``. + The previous value is returned and can be used to restore + the original value later if needed. + + In contrast to `Set Selenium Timeout` and `Set Selenium Implicit Wait` + this keywords sets the time for Webdriver to wait until page + is loaded before throwing an error. + + See the `Page load` section above for more information. + + Example: + | ${orig pl timeout} = | `Set Selenium Page Load Timeout` | 30 seconds | + | `Open page that loads slowly` | + | `Set Selenium Page Load Timeout` | ${orig pl timeout} | + + New in SeleniumLibrary 6.1 + """ + old_page_load_timeout = self.get_selenium_page_load_timeout() + self.ctx.page_load_timeout = _convert_timeout(value) + for driver in self.drivers.active_drivers: + driver.set_page_load_timeout(self.ctx.page_load_timeout) + return old_page_load_timeout + def _make_driver( self, browser, @@ -722,6 +763,7 @@ def _make_driver( ) driver.set_script_timeout(self.ctx.timeout) driver.implicitly_wait(self.ctx.implicit_wait) + driver.set_page_load_timeout(self.ctx.page_load_timeout) if self.ctx.speed: self._monkey_patch_speed(driver) return driver diff --git a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt index 95bb3f270..ffaa13588 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt @@ -298,6 +298,17 @@ Selenium documentation] for more information about this functionality. See `time format` below for supported syntax. +== Page load == +Page load timeout is the amount of time to wait for page load to complete until error is raised. + +The default page load timeout can be set globally +when `importing` the library with the ``page_load_timeout`` argument +or by using the `Set Selenium Page Load Timeout` keyword. + +See `time format` below for supported timeout syntax. + +Support for page load is new in SeleniumLibrary 6.1 + == Selenium speed == Selenium execution speed can be slowed down globally by using `Set diff --git a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt index 5c8d629d2..6d1c0c3ec 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt @@ -4,6 +4,8 @@ SeleniumLibrary can be imported with several optional arguments. Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. +- ``page_load_timeout``: + Default value to wait for page load to complete until error is raised. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 7218e637b..2c35e3c40 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 173) + self.assertEqual(len(sl.get_keyword_names()), 175) def test_parse_library(self): plugin = "path.to.MyLibrary" diff --git a/utest/test/keywords/test_browsermanagement.py b/utest/test/keywords/test_browsermanagement.py index f3e67b576..450428738 100644 --- a/utest/test/keywords/test_browsermanagement.py +++ b/utest/test/keywords/test_browsermanagement.py @@ -54,6 +54,34 @@ def test_selenium_implicit_wait_get(): assert org_value == "3 seconds" +def test_selenium_page_load_timeout_with_default(): + sl = SeleniumLibrary() + assert sl.page_load_timeout == 10.0, "Page load timeout should be 10.0" + + +def test_set_selenium_page_load_timeout(): + sl = SeleniumLibrary() + sl.set_selenium_page_load_timeout("5.0") + assert sl.page_load_timeout == 5.0 + + sl.set_selenium_page_load_timeout("1 min") + assert sl.page_load_timeout == 60.0 + + +def test_set_selenium_page_load_timeout_returns_orig_page_load_timeout(): + sl = SeleniumLibrary(page_load_timeout="20") + orig_page_load_timeout = sl.set_selenium_page_load_timeout("1 second") + + assert orig_page_load_timeout == "20 seconds" + assert sl.page_load_timeout == 1.0 + + +def test_get_selenium_page_load_timeout(): + sl = SeleniumLibrary(page_load_timeout="15 seconds") + + assert sl.get_selenium_page_load_timeout() == "15 seconds" + + def test_bad_browser_name(): ctx = mock() bm = BrowserManagementKeywords(ctx) From 895857fb42cddf4dd4a16a9bd0b0e9dc8b5213e9 Mon Sep 17 00:00:00 2001 From: Robin Matz Date: Wed, 12 Apr 2023 05:59:28 +0200 Subject: [PATCH 055/407] Add atests --- .../keywords/page_load_timeout.robot | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 atest/acceptance/keywords/page_load_timeout.robot diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot new file mode 100644 index 000000000..eab6d4af3 --- /dev/null +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -0,0 +1,30 @@ +*** Settings *** +Resource ../resource.robot + +Test Teardown Close Browser And Reset Page Load Timeout + +*** Test Cases *** +Should Open Browser With Default Page Load Timeout + [Documentation] Verify that 'Open Browser' changes the page load timeout. + ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 10000} + ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 + Open Browser To Start Page + +Should Run Into Timeout Exception + [Documentation] + ... FAIL REGEXP: TimeoutException: Message: (timeout: Timed out receiving message from renderer|TimedPromise timed out).* + Open Browser To Start Page + Set Selenium Page Load Timeout 1 ms + Reload Page + +Should Set Page Load Timeout For All Opened Browsers + [Documentation] One browser is already opened as global suite setup. + ... LOG 2:1 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 5000} + ... LOG 2:5 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 5000} + Open Browser To Start Page + Set Selenium Page Load Timeout 5 s + +*** Keywords *** +Close Browser And Reset Page Load Timeout + Close Browser + Set Selenium Page Load Timeout 10 s From 4c0cece8414c8d1678728c51398db56017daad28 Mon Sep 17 00:00:00 2001 From: Robin Matz Date: Thu, 13 Apr 2023 06:03:54 +0200 Subject: [PATCH 056/407] Switch to suite browser after page load tests --- atest/acceptance/keywords/__init__.robot | 2 +- atest/acceptance/keywords/page_load_timeout.robot | 4 ++++ atest/acceptance/resource.robot | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/__init__.robot b/atest/acceptance/keywords/__init__.robot index 58158758d..1bb0ef241 100644 --- a/atest/acceptance/keywords/__init__.robot +++ b/atest/acceptance/keywords/__init__.robot @@ -1,4 +1,4 @@ *** Settings *** Resource ../resource.robot -Suite Setup Open Browser To Start Page +Suite Setup Open Browser To Start Page keywords Suite Teardown Close All Browsers diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index eab6d4af3..dd665443d 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -1,6 +1,7 @@ *** Settings *** Resource ../resource.robot +Suite Teardown Switch Back To Suite Browser Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** @@ -28,3 +29,6 @@ Should Set Page Load Timeout For All Opened Browsers Close Browser And Reset Page Load Timeout Close Browser Set Selenium Page Load Timeout 10 s + +Switch Back To Suite Browser + Switch Browser keywords diff --git a/atest/acceptance/resource.robot b/atest/acceptance/resource.robot index e16c993df..2ff32f7c8 100644 --- a/atest/acceptance/resource.robot +++ b/atest/acceptance/resource.robot @@ -17,7 +17,9 @@ ${SPEED}= 0 Open Browser To Start Page [Documentation] This keyword also tests 'Set Selenium Speed' and 'Set Selenium Timeout' ... against all reason. + [Arguments] ${alias}=${None} ${default speed} ${default timeout}= Open Browser To Start Page Without Testing Default Options + ... ${alias} # FIXME: We shouldn't test anything here. If this stuff isn't tested elsewhere, new *tests* needs to be added. # FIXME: The second test below verifies a hard coded return value!!?! Should Be Equal ${default speed} 0 seconds @@ -25,8 +27,9 @@ Open Browser To Start Page Open Browser To Start Page Without Testing Default Options [Documentation] Open Browser To Start Page Without Testing Default Options + [Arguments] ${alias}=${None} Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... desired_capabilities=${DESIRED_CAPABILITIES} + ... desired_capabilities=${DESIRED_CAPABILITIES} alias=${alias} ${orig speed} = Set Selenium Speed ${SPEED} ${orig timeout} = Set Selenium Timeout 10 seconds [Return] ${orig speed} 5 seconds From 9dd3d8a2f1fc5db673bf89fbd18958941882e132 Mon Sep 17 00:00:00 2001 From: Robin Matz Date: Tue, 18 Apr 2023 21:33:49 +0200 Subject: [PATCH 057/407] Maintain backwards compatibility --- atest/acceptance/keywords/page_load_timeout.robot | 4 ++-- src/SeleniumLibrary/__init__.py | 6 +++--- src/SeleniumLibrary/keywords/browsermanagement.py | 4 ++-- ...ginDocumentation.test_parse_plugin_init_doc.approved.txt | 4 ++-- utest/test/keywords/test_browsermanagement.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index dd665443d..989207e17 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -7,7 +7,7 @@ Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** Should Open Browser With Default Page Load Timeout [Documentation] Verify that 'Open Browser' changes the page load timeout. - ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 10000} + ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 Open Browser To Start Page @@ -28,7 +28,7 @@ Should Set Page Load Timeout For All Opened Browsers *** Keywords *** Close Browser And Reset Page Load Timeout Close Browser - Set Selenium Page Load Timeout 10 s + Set Selenium Page Load Timeout 5 minutes Switch Back To Suite Browser Switch Browser keywords diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 58cb31c8f..5a821c5cd 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -442,11 +442,11 @@ def __init__( self, timeout=timedelta(seconds=5), implicit_wait=timedelta(seconds=0), - page_load_timeout=timedelta(seconds=10), run_on_failure="Capture Page Screenshot", screenshot_root_directory: Optional[str] = None, plugins: Optional[str] = None, event_firing_webdriver: Optional[str] = None, + page_load_timeout=timedelta(minutes=5), ): """SeleniumLibrary can be imported with several optional arguments. @@ -454,8 +454,6 @@ def __init__( Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. - - ``page_load_timeout``: - Default value to wait for page load to complete until error is raised. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -467,6 +465,8 @@ def __init__( - ``event_firing_webdriver``: Class for wrapping Selenium with [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] + - ``page_load_timeout``: + Default value to wait for page load to complete until error is raised. """ self.timeout = _convert_timeout(timeout) self.implicit_wait = _convert_timeout(implicit_wait) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index ba8f65c87..3305376f4 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -730,9 +730,9 @@ def set_selenium_page_load_timeout(self, value: timedelta) -> str: See the `Page load` section above for more information. Example: - | ${orig pl timeout} = | `Set Selenium Page Load Timeout` | 30 seconds | + | ${orig page load timeout} = | `Set Selenium Page Load Timeout` | 30 seconds | | `Open page that loads slowly` | - | `Set Selenium Page Load Timeout` | ${orig pl timeout} | + | `Set Selenium Page Load Timeout` | ${orig page load timeout} | New in SeleniumLibrary 6.1 """ diff --git a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt index 6d1c0c3ec..ca6c5903e 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt @@ -4,8 +4,6 @@ SeleniumLibrary can be imported with several optional arguments. Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. -- ``page_load_timeout``: - Default value to wait for page load to complete until error is raised. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -17,3 +15,5 @@ SeleniumLibrary can be imported with several optional arguments. - ``event_firing_webdriver``: Class for wrapping Selenium with [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] +- ``page_load_timeout``: + Default value to wait for page load to complete until error is raised. diff --git a/utest/test/keywords/test_browsermanagement.py b/utest/test/keywords/test_browsermanagement.py index 450428738..189b5578d 100644 --- a/utest/test/keywords/test_browsermanagement.py +++ b/utest/test/keywords/test_browsermanagement.py @@ -56,7 +56,7 @@ def test_selenium_implicit_wait_get(): def test_selenium_page_load_timeout_with_default(): sl = SeleniumLibrary() - assert sl.page_load_timeout == 10.0, "Page load timeout should be 10.0" + assert sl.page_load_timeout == 300.0, "Default page load timeout should be 5 minutes" def test_set_selenium_page_load_timeout(): From 65027e603893fc9b2e15bf25d08368bece2d5484 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 27 Apr 2023 15:40:51 -0400 Subject: [PATCH 058/407] Moved action_chain_delay argument to last position for backwards compatability As with the addition of the page_load_timeout, moved action_chain_delay into the last position so if anyone has poorly structured Library imports (which should be using named arguments) this will not break their implementations. --- src/SeleniumLibrary/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 9b5cc1461..7372f42b2 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -442,12 +442,12 @@ def __init__( self, timeout=timedelta(seconds=5), implicit_wait=timedelta(seconds=0), - action_chain_delay=timedelta(seconds=0.25), run_on_failure="Capture Page Screenshot", screenshot_root_directory: Optional[str] = None, plugins: Optional[str] = None, event_firing_webdriver: Optional[str] = None, page_load_timeout=timedelta(minutes=5), + action_chain_delay=timedelta(seconds=0.25), ): """SeleniumLibrary can be imported with several optional arguments. @@ -455,8 +455,6 @@ def __init__( Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. - - ``action_chain_delay``: - Default value for `ActionChains` delay to wait in between actions. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -470,6 +468,8 @@ def __init__( [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] - ``page_load_timeout``: Default value to wait for page load to complete until error is raised. + - ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. """ self.timeout = _convert_timeout(timeout) self.implicit_wait = _convert_timeout(implicit_wait) From fc564a3ee65a6b5c1ea2ddf2e336b8d3c2d48bce Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 27 Apr 2023 10:57:37 -0400 Subject: [PATCH 059/407] Triaging the `Handle Alert when popup window closes` tests It looks like the error message on this test has changed. It is unclear at the time what this test is supposed to do and where the expected error message should come in. As such I am going to triage the test for later review. --- atest/acceptance/keywords/alerts.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/alerts.robot b/atest/acceptance/keywords/alerts.robot index d3732dcb8..bd6f0ecaf 100644 --- a/atest/acceptance/keywords/alerts.robot +++ b/atest/acceptance/keywords/alerts.robot @@ -124,6 +124,7 @@ Handle Alert when popup window closes [Documentation] Popup window is closed by javascript while ... 'Handle Alert' keyword is waiting for alert ... FAIL GLOB: An exception occurred waiting for alert* + [Tags] Triage [Setup] Go To Page "javascript/self_closing_popup.html" Click Button Self Closing ${handle} = Switch Window NEW From a78088d3a07923b15065c192705326146223a105 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 27 Apr 2023 16:25:30 -0400 Subject: [PATCH 060/407] Updated expected results of various tests - Updated number of expected keywords based upon the two added for the setting action_chain_delay - Moved expected position of the action_chain_delay argument documentation to the bottom of the list --- ...luginDocumentation.test_parse_plugin_init_doc.approved.txt | 4 ++-- utest/test/api/test_plugins.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt index 273e04c07..e45c06ff3 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt @@ -4,8 +4,6 @@ SeleniumLibrary can be imported with several optional arguments. Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. -- ``action_chain_delay``: - Default value for `ActionChains` delay to wait in between actions. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: @@ -19,3 +17,5 @@ SeleniumLibrary can be imported with several optional arguments. [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] - ``page_load_timeout``: Default value to wait for page load to complete until error is raised. +- ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 2c35e3c40..89e33c247 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 175) + self.assertEqual(len(sl.get_keyword_names()), 177) def test_parse_library(self): plugin = "path.to.MyLibrary" From d46fa96c159c45e5c03d154af9490769b7bbfb93 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 28 Apr 2023 09:00:17 -0400 Subject: [PATCH 061/407] Release notes for 6.1.0rc1 --- docs/SeleniumLibrary-6.1.0rc1.rst | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 docs/SeleniumLibrary-6.1.0rc1.rst diff --git a/docs/SeleniumLibrary-6.1.0rc1.rst b/docs/SeleniumLibrary-6.1.0rc1.rst new file mode 100644 index 000000000..5da25f7cb --- /dev/null +++ b/docs/SeleniumLibrary-6.1.0rc1.rst @@ -0,0 +1,53 @@ +======================== +SeleniumLibrary 6.1.0rc1 +======================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.1.0rc1 is a new release with +**UPDATE** enhancements and bug fixes. **ADD more intro stuff...** + +All issues targeted for SeleniumLibrary v6.1.0 can be found +from the `issue tracker`_. + +If you have pip_ installed, just run + +:: + + pip install --pre --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.1.0rc1 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.1.0rc1 was released on Thursday April 28, 2023. SeleniumLibrary supports +Python 3.7+, Selenium 4.0+ and Robot Framework 4.1.3 or higher. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.1.0 + + +.. contents:: + :depth: 2 + :local: + +Full list of fixes and enhancements +=================================== + +The full list of issues will be shown in a later release candidate. I am currently compiling the list but not +wanting to delay this release candidate. + +View on the `issue tracker `__. + From 7b8609dcb06cd14f75abeb30cf581cad603584a7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 28 Apr 2023 09:00:52 -0400 Subject: [PATCH 062/407] Updated version to 6.1.0rc1 --- src/SeleniumLibrary/__init__.py | 1376 +++++++++++++++---------------- 1 file changed, 688 insertions(+), 688 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 7372f42b2..a00b40b8e 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -1,688 +1,688 @@ -# Copyright 2008-2011 Nokia Networks -# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors -# Copyright 2016- Robot Framework Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from collections import namedtuple -from datetime import timedelta -from inspect import getdoc, isclass -from typing import Optional, List - -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 -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement - -from SeleniumLibrary.base import LibraryComponent -from SeleniumLibrary.errors import NoOpenBrowser, PluginError -from SeleniumLibrary.keywords import ( - AlertKeywords, - BrowserManagementKeywords, - CookieKeywords, - ElementKeywords, - FormElementKeywords, - FrameKeywords, - JavaScriptKeywords, - RunOnFailureKeywords, - ScreenshotKeywords, - SelectElementKeywords, - TableElementKeywords, - WaitingKeywords, - WebDriverCache, - WindowKeywords, -) -from SeleniumLibrary.keywords.screenshot import EMBED -from SeleniumLibrary.locators import ElementFinder -from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay - - -__version__ = "6.1.0.dev1" - - -class SeleniumLibrary(DynamicCore): - """SeleniumLibrary is a web testing library for Robot Framework. - - This document explains how to use keywords provided by SeleniumLibrary. - For information about installation, support, and more, please visit the - [https://github.com/robotframework/SeleniumLibrary|project pages]. - For more information about Robot Framework, see http://robotframework.org. - - SeleniumLibrary uses the Selenium WebDriver modules internally to - control a web browser. See http://seleniumhq.org for more information - about Selenium in general and SeleniumLibrary README.rst - [https://github.com/robotframework/SeleniumLibrary#browser-drivers|Browser drivers chapter] - for more details about WebDriver binary installation. - - %TOC% - - = Locating elements = - - All keywords in SeleniumLibrary that need to interact with an element - on a web page take an argument typically named ``locator`` that specifies - how to find the element. Most often the locator is given as a string - using the locator syntax described below, but `using WebElements` is - possible too. - - == Locator syntax == - - SeleniumLibrary supports finding elements based on different strategies - such as the element id, XPath expressions, or CSS selectors. The strategy - can either be explicitly specified with a prefix or the strategy can be - implicit. - - === Default locator strategy === - - By default, locators are considered to use the keyword specific default - locator strategy. All keywords support finding elements based on ``id`` - and ``name`` attributes, but some keywords support additional attributes - or other values that make sense in their context. For example, `Click - Link` supports the ``href`` attribute and the link text and addition - to the normal ``id`` and ``name``. - - Examples: - - | `Click Element` | example | # Match based on ``id`` or ``name``. | - | `Click Link` | example | # Match also based on link text and ``href``. | - | `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. | - - If a locator accidentally starts with a prefix recognized as `explicit - locator strategy` or `implicit XPath strategy`, it is possible to use - the explicit ``default`` prefix to enable the default strategy. - - Examples: - - | `Click Element` | name:foo | # Find element with name ``foo``. | - | `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. | - | `Click Element` | //foo | # Find element using XPath ``//foo``. | - | `Click Element` | default: //foo | # Use default strategy with value ``//foo``. | - - === Explicit locator strategy === - - The explicit locator strategy is specified with a prefix using either - syntax ``strategy:value`` or ``strategy=value``. The former syntax - is preferred because the latter is identical to Robot Framework's - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-argument-syntax| - named argument syntax] and that can cause problems. Spaces around - the separator are ignored, so ``id:foo``, ``id: foo`` and ``id : foo`` - are all equivalent. - - Locator strategies that are supported by default are listed in the table - below. In addition to them, it is possible to register `custom locators`. - - | = Strategy = | = Match based on = | = Example = | - | id | Element ``id``. | ``id:example`` | - | name | ``name`` attribute. | ``name:example`` | - | identifier | Either ``id`` or ``name``. | ``identifier:example`` | - | class | Element ``class``. | ``class:example`` | - | tag | Tag name. | ``tag:div`` | - | xpath | XPath expression. | ``xpath://div[@id="example"]`` | - | css | CSS selector. | ``css:div#example`` | - | dom | DOM expression. | ``dom:document.images[5]`` | - | link | Exact text a link has. | ``link:The example`` | - | partial link | Partial link text. | ``partial link:he ex`` | - | sizzle | Sizzle selector deprecated. | ``sizzle:div.example`` | - | data | Element ``data-*`` attribute | ``data:id:my_id`` | - | jquery | jQuery expression. | ``jquery:div.example`` | - | default | Keyword specific default behavior. | ``default:example`` | - - See the `Default locator strategy` section below for more information - about how the default strategy works. Using the explicit ``default`` - prefix is only necessary if the locator value itself accidentally - matches some of the explicit strategies. - - Different locator strategies have different pros and cons. Using ids, - either explicitly like ``id:foo`` or by using the `default locator - strategy` simply like ``foo``, is recommended when possible, because - the syntax is simple and locating elements by id is fast for browsers. - If an element does not have an id or the id is not stable, other - solutions need to be used. If an element has a unique tag name or class, - using ``tag``, ``class`` or ``css`` strategy like ``tag:h1``, - ``class:example`` or ``css:h1.example`` is often an easy solution. In - more complex cases using XPath expressions is typically the best - approach. They are very powerful but a downside is that they can also - get complex. - - Examples: - - | `Click Element` | id:foo | # Element with id 'foo'. | - | `Click Element` | css:div#foo h1 | # h1 element under div with id 'foo'. | - | `Click Element` | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. | - | `Click Element` | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. | - - *NOTE:* - - - The ``strategy:value`` syntax is only supported by SeleniumLibrary 3.0 - and newer. - - Using the ``sizzle`` strategy or its alias ``jquery`` requires that - the system under test contains the jQuery library. - - Prior to SeleniumLibrary 3.0, table related keywords only supported - ``xpath``, ``css`` and ``sizzle/jquery`` strategies. - - ``data`` strategy is conveniance locator that will construct xpath from the parameters. - If you have element like `
`, you locate the element via - ``data:automation:automation-id-2``. This feature was added in SeleniumLibrary 5.2.0 - - === Implicit XPath strategy === - - If the locator starts with ``//`` or multiple opening parenthesis in front - of the ``//``, the locator is considered to be an XPath expression. In other - words, using ``//div`` is equivalent to using explicit ``xpath://div`` and - ``((//div))`` is equivalent to using explicit ``xpath:((//div))`` - - Examples: - - | `Click Element` | //div[@id="foo"]//h1 | - | `Click Element` | (//div)[2] | - - The support for the ``(//`` prefix is new in SeleniumLibrary 3.0. - Supporting multiple opening parenthesis is new in SeleniumLibrary 5.0. - - === Chaining locators === - - It is possible chain multiple locators together as single locator. Each chained locator must start with locator - strategy. Chained locators must be separated with single space, two greater than characters and followed with - space. It is also possible mix different locator strategies, example css or xpath. Also a list can also be - used to specify multiple locators. This is useful, is some part of locator would match as the locator separator - but it should not. Or if there is need to existing WebElement as locator. - - Although all locators support chaining, some locator strategies do not abey the chaining. This is because - some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context - and not for the element found be the previous locator. Chaining is supported by locator strategies which - are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery - - Examples: - | `Click Element` | css:.bar >> xpath://a | # To find a link which is present after an element with class "bar" | - - List examples: - | ${locator_list} = | `Create List` | css:div#div_id | xpath://*[text(), " >> "] | - | `Page Should Contain Element` | ${locator_list} | | | - | ${element} = | Get WebElement | xpath://*[text(), " >> "] | | - | ${locator_list} = | `Create List` | css:div#div_id | ${element} | - | `Page Should Contain Element` | ${locator_list} | | | - - Chaining locators in new in SeleniumLibrary 5.0 - - == Using WebElements == - - In addition to specifying a locator as a string, it is possible to use - Selenium's WebElement objects. This requires first getting a WebElement, - for example, by using the `Get WebElement` keyword. - - | ${elem} = | `Get WebElement` | id:example | - | `Click Element` | ${elem} | | - - == Custom locators == - - If more complex lookups are required than what is provided through the - default locators, custom lookup strategies can be created. Using custom - locators is a two part process. First, create a keyword that returns - a WebElement that should be acted on: - - | Custom Locator Strategy | [Arguments] | ${browser} | ${locator} | ${tag} | ${constraints} | - | | ${element}= | Execute Javascript | return window.document.getElementById('${locator}'); | - | | [Return] | ${element} | - - This keyword is a reimplementation of the basic functionality of the - ``id`` locator where ``${browser}`` is a reference to a WebDriver - instance and ``${locator}`` is the name of the locator strategy. To use - this locator, it must first be registered by using the - `Add Location Strategy` keyword: - - | `Add Location Strategy` | custom | Custom Locator Strategy | - - The first argument of `Add Location Strategy` specifies the name of - the strategy and it must be unique. After registering the strategy, - the usage is the same as with other locators: - - | `Click Element` | custom:example | - - See the `Add Location Strategy` keyword for more details. - - = Browser and Window = - - There is different conceptual meaning when SeleniumLibrary talks - about windows or browsers. This chapter explains those differences. - - == Browser == - - When `Open Browser` or `Create WebDriver` keyword is called, it - will create a new Selenium WebDriver instance by using the - [https://www.seleniumhq.org/docs/03_webdriver.jsp|Selenium WebDriver] - API. In SeleniumLibrary terms, a new browser is created. It is - possible to start multiple independent browsers (Selenium Webdriver - instances) at the same time, by calling `Open Browser` or - `Create WebDriver` multiple times. These browsers are usually - independent of each other and do not share data like cookies, - sessions or profiles. Typically when the browser starts, it - creates a single window which is shown to the user. - - == Window == - - Windows are the part of a browser that loads the web site and presents - it to the user. All content of the site is the content of the window. - Windows are children of a browser. In SeleniumLibrary browser is a - synonym for WebDriver instance. One browser may have multiple - windows. Windows can appear as tabs, as separate windows or pop-ups with - different position and size. Windows belonging to the same browser - typically share the sessions detail, like cookies. If there is a - need to separate sessions detail, example login with two different - users, two browsers (Selenium WebDriver instances) must be created. - New windows can be opened example by the application under test or - by example `Execute Javascript` keyword: - - | `Execute Javascript` window.open() # Opens a new window with location about:blank - - The example below opens multiple browsers and windows, - to demonstrate how the different keywords can be used to interact - with browsers, and windows attached to these browsers. - - Structure: - | BrowserA - | Window 1 (location=https://robotframework.org/) - | Window 2 (location=https://robocon.io/) - | Window 3 (location=https://github.com/robotframework/) - | - | BrowserB - | Window 1 (location=https://github.com/) - - Example: - | `Open Browser` | https://robotframework.org | ${BROWSER} | alias=BrowserA | # BrowserA with first window is opened. | - | `Execute Javascript` | window.open() | | | # In BrowserA second window is opened. | - | `Switch Window` | locator=NEW | | | # Switched to second window in BrowserA | - | `Go To` | https://robocon.io | | | # Second window navigates to robocon site. | - | `Execute Javascript` | window.open() | | | # In BrowserA third window is opened. | - | ${handle} | `Switch Window` | locator=NEW | | # Switched to third window in BrowserA | - | `Go To` | https://github.com/robotframework/ | | | # Third windows goes to robot framework github site. | - | `Open Browser` | https://github.com | ${BROWSER} | alias=BrowserB | # BrowserB with first windows is opened. | - | ${location} | `Get Location` | | | # ${location} is: https://www.github.com | - | `Switch Window` | ${handle} | browser=BrowserA | | # BrowserA second windows is selected. | - | ${location} | `Get Location` | | | # ${location} = https://robocon.io/ | - | @{locations 1} | `Get Locations` | | | # By default, lists locations under the currectly active browser (BrowserA). | - | @{locations 2} | `Get Locations` | browser=ALL | | # By using browser=ALL argument keyword list all locations from all browsers. | - - The above example, @{locations 1} contains the following items: - https://robotframework.org/, https://robocon.io/ and - https://github.com/robotframework/'. The @{locations 2} - contains the following items: https://robotframework.org/, - https://robocon.io/, https://github.com/robotframework/' - and 'https://github.com/. - - = Timeouts, waits, and delays = - - This section discusses different ways how to wait for elements to - appear on web pages and to slow down execution speed otherwise. - It also explains the `time format` that can be used when setting various - timeouts, waits, and delays. - - == Timeout == - - SeleniumLibrary contains various keywords that have an optional - ``timeout`` argument that specifies how long these keywords should - wait for certain events or actions. These keywords include, for example, - ``Wait ...`` keywords and keywords related to alerts. Additionally - `Execute Async Javascript`. Although it does not have ``timeout``, - argument, uses a timeout to define how long asynchronous JavaScript - can run. - - The default timeout these keywords use can be set globally either by - using the `Set Selenium Timeout` keyword or with the ``timeout`` argument - when `importing` the library. If no default timeout is set globally, the - default is 5 seconds. If None is specified for the timeout argument in the - keywords, the default is used. See `time format` below for supported - timeout syntax. - - == Implicit wait == - - Implicit wait specifies the maximum time how long Selenium waits when - searching for elements. It can be set by using the `Set Selenium Implicit - Wait` keyword or with the ``implicit_wait`` argument when `importing` - the library. See [https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp| - Selenium documentation] for more information about this functionality. - - See `time format` below for supported syntax. - - == Page load == - Page load timeout is the amount of time to wait for page load to complete until error is raised. - - The default page load timeout can be set globally - when `importing` the library with the ``page_load_timeout`` argument - or by using the `Set Selenium Page Load Timeout` keyword. - - See `time format` below for supported timeout syntax. - - Support for page load is new in SeleniumLibrary 6.1 - - == Selenium speed == - - Selenium execution speed can be slowed down globally by using `Set - Selenium speed` keyword. This functionality is designed to be used for - demonstrating or debugging purposes. Using it to make sure that elements - appear on a page is not a good idea. The above-explained timeouts - and waits should be used instead. - - See `time format` below for supported syntax. - - == Time format == - - All timeouts and waits can be given as numbers considered seconds - (e.g. ``0.5`` or ``42``) or in Robot Framework's time syntax - (e.g. ``1.5 seconds`` or ``1 min 30 s``). For more information about - the time syntax see the - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format|Robot Framework User Guide]. - - = Run-on-failure functionality = - - SeleniumLibrary has a handy feature that it can automatically execute - a keyword if any of its own keywords fails. By default, it uses the - `Capture Page Screenshot` keyword, but this can be changed either by - using the `Register Keyword To Run On Failure` keyword or with the - ``run_on_failure`` argument when `importing` the library. It is - possible to use any keyword from any imported library or resource file. - - The run-on-failure functionality can be disabled by using a special value - ``NOTHING`` or anything considered false (see `Boolean arguments`) - such as ``NONE``. - - = Boolean arguments = - - Starting from 5.0 SeleniumLibrary relies on Robot Framework to perform the - boolean conversion based on keyword arguments [https://docs.python.org/3/library/typing.html|type hint]. - More details in Robot Framework - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#supported-conversions|user guide] - - Please note SeleniumLibrary 3 and 4 did have own custom methods to covert - arguments to boolean values. - - = EventFiringWebDriver = - - The SeleniumLibrary offers support for - [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver]. - See the Selenium and SeleniumLibrary - [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#EventFiringWebDriver|EventFiringWebDriver support] - documentation for further details. - - EventFiringWebDriver is new in SeleniumLibrary 4.0 - - = Thread support = - - SeleniumLibrary is not thread-safe. This is mainly due because the underlying - [https://github.com/SeleniumHQ/selenium/wiki/Frequently-Asked-Questions#q-is-webdriver-thread-safe| - Selenium tool is not thread-safe] within one browser/driver instance. - Because of the limitation in the Selenium side, the keywords or the - API provided by the SeleniumLibrary is not thread-safe. - - = Plugins = - - SeleniumLibrary offers plugins as a way to modify and add library keywords and modify some of the internal - functionality without creating a new library or hacking the source code. See - [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#Plugins|plugin API] - documentation for further details. - - Plugin API is new SeleniumLibrary 4.0 - """ - - ROBOT_LIBRARY_SCOPE = "GLOBAL" - ROBOT_LIBRARY_VERSION = __version__ - - def __init__( - self, - timeout=timedelta(seconds=5), - implicit_wait=timedelta(seconds=0), - run_on_failure="Capture Page Screenshot", - screenshot_root_directory: Optional[str] = None, - plugins: Optional[str] = None, - event_firing_webdriver: Optional[str] = None, - page_load_timeout=timedelta(minutes=5), - action_chain_delay=timedelta(seconds=0.25), - ): - """SeleniumLibrary can be imported with several optional arguments. - - - ``timeout``: - Default value for `timeouts` used with ``Wait ...`` keywords. - - ``implicit_wait``: - Default value for `implicit wait` used when locating elements. - - ``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. - If not given, the directory where the log file is written is used. - - ``plugins``: - Allows extending the SeleniumLibrary with external Python classes. - - ``event_firing_webdriver``: - Class for wrapping Selenium with - [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] - - ``page_load_timeout``: - Default value to wait for page load to complete until error is raised. - - ``action_chain_delay``: - Default value for `ActionChains` delay to wait in between actions. - """ - self.timeout = _convert_timeout(timeout) - self.implicit_wait = _convert_timeout(implicit_wait) - self.action_chain_delay = _convert_delay(action_chain_delay) - self.page_load_timeout = _convert_timeout(page_load_timeout) - self.speed = 0.0 - self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( - run_on_failure - ) - self._running_on_failure_keyword = False - self.screenshot_root_directory = screenshot_root_directory - self._resolve_screenshot_root_directory() - self._element_finder = ElementFinder(self) - self._plugin_keywords = [] - libraries = [ - AlertKeywords(self), - BrowserManagementKeywords(self), - CookieKeywords(self), - ElementKeywords(self), - FormElementKeywords(self), - FrameKeywords(self), - JavaScriptKeywords(self), - RunOnFailureKeywords(self), - ScreenshotKeywords(self), - SelectElementKeywords(self), - TableElementKeywords(self), - WaitingKeywords(self), - WindowKeywords(self), - ] - self.ROBOT_LIBRARY_LISTENER = LibraryListener() - self._running_keyword = None - self.event_firing_webdriver = None - if is_truthy(event_firing_webdriver): - self.event_firing_webdriver = self._parse_listener(event_firing_webdriver) - self._plugins = [] - if is_truthy(plugins): - plugin_libs = self._parse_plugins(plugins) - self._plugins = plugin_libs - libraries = libraries + plugin_libs - self._drivers = WebDriverCache() - DynamicCore.__init__(self, libraries) - - def run_keyword(self, name: str, args: tuple, kwargs: dict): - try: - return DynamicCore.run_keyword(self, name, args, kwargs) - except Exception: - self.failure_occurred() - raise - - def get_keyword_tags(self, name: str) -> list: - tags = list(DynamicCore.get_keyword_tags(self, name)) - if name in self._plugin_keywords: - tags.append("plugin") - return tags - - def get_keyword_documentation(self, name: str) -> str: - if name == "__intro__": - return self._get_intro_documentation() - return DynamicCore.get_keyword_documentation(self, name) - - def _parse_plugin_doc(self): - Doc = namedtuple("Doc", "doc, name") - for plugin in self._plugins: - yield Doc( - doc=getdoc(plugin) or "No plugin documentation found.", - name=plugin.__class__.__name__, - ) - - def _get_intro_documentation(self): - intro = DynamicCore.get_keyword_documentation(self, "__intro__") - for plugin_doc in self._parse_plugin_doc(): - intro = f"{intro}\n\n" - intro = f"{intro}= Plugin: {plugin_doc.name} =\n\n" - intro = f"{intro}{plugin_doc.doc}" - return intro - - def register_driver(self, driver: WebDriver, alias: str): - """Add's a `driver` to the library WebDriverCache. - - :param driver: Instance of the Selenium `WebDriver`. - :type driver: selenium.webdriver.remote.webdriver.WebDriver - :param alias: Alias given for this `WebDriver` instance. - :type alias: str - :return: The index of the `WebDriver` instance. - :rtype: int - """ - return self._drivers.register(driver, alias) - - def failure_occurred(self): - """Method that is executed when a SeleniumLibrary keyword fails. - - By default, executes the registered run-on-failure keyword. - Libraries extending SeleniumLibrary can overwrite this hook - method if they want to provide custom functionality instead. - """ - if self._running_on_failure_keyword or not self.run_on_failure_keyword: - return - try: - self._running_on_failure_keyword = True - if self.run_on_failure_keyword.lower() == "capture page screenshot": - self.capture_page_screenshot() - else: - BuiltIn().run_keyword(self.run_on_failure_keyword) - except Exception as err: - logger.warn( - f"Keyword '{self.run_on_failure_keyword}' could not be run on failure: {err}" - ) - finally: - self._running_on_failure_keyword = False - - @property - def driver(self) -> WebDriver: - """Current active driver. - - :rtype: selenium.webdriver.remote.webdriver.WebDriver - :raises SeleniumLibrary.errors.NoOpenBrowser: If browser is not open. - """ - if not self._drivers.current: - raise NoOpenBrowser("No browser is open.") - return self._drivers.current - - def find_element( - self, locator: str, parent: Optional[WebElement] = None - ) -> WebElement: - """Find element matching `locator`. - - :param locator: Locator to use when searching the element. - See library documentation for the supported locator syntax. - :type locator: str or selenium.webdriver.remote.webelement.WebElement - :param parent: Optional parent `WebElememt` to search child elements - from. By default, search starts from the root using `WebDriver`. - :type parent: selenium.webdriver.remote.webelement.WebElement - :return: Found `WebElement`. - :rtype: selenium.webdriver.remote.webelement.WebElement - :raises SeleniumLibrary.errors.ElementNotFound: If element not found. - """ - return self._element_finder.find(locator, parent=parent) - - def find_elements( - self, locator: str, parent: WebElement = None - ) -> List[WebElement]: - """Find all elements matching `locator`. - - :param locator: Locator to use when searching the element. - See library documentation for the supported locator syntax. - :type locator: str or selenium.webdriver.remote.webelement.WebElement - :param parent: Optional parent `WebElememt` to search child elements - from. By default, search starts from the root using `WebDriver`. - :type parent: selenium.webdriver.remote.webelement.WebElement - :return: list of found `WebElement` or e,mpty if elements are not found. - :rtype: list[selenium.webdriver.remote.webelement.WebElement] - """ - return self._element_finder.find( - locator, first_only=False, required=False, parent=parent - ) - - def _parse_plugins(self, plugins): - libraries = [] - importer = Importer("test library") - for parsed_plugin in self._string_to_modules(plugins): - plugin = importer.import_class_or_module(parsed_plugin.module) - if not isclass(plugin): - message = f"Importing test library: '{parsed_plugin.module}' failed." - raise DataError(message) - plugin = plugin(self, *parsed_plugin.args, **parsed_plugin.kw_args) - if not isinstance(plugin, LibraryComponent): - message = ( - "Plugin does not inherit SeleniumLibrary.base.LibraryComponent" - ) - raise PluginError(message) - self._store_plugin_keywords(plugin) - libraries.append(plugin) - return libraries - - def _parse_listener(self, event_firing_webdriver): - listener_module = self._string_to_modules(event_firing_webdriver) - listener_count = len(listener_module) - if listener_count > 1: - message = f"Is is possible import only one listener but there was {listener_count} listeners." - raise ValueError(message) - listener_module = listener_module[0] - importer = Importer("test library") - listener = importer.import_class_or_module(listener_module.module) - if not isclass(listener): - message = f"Importing test Selenium lister class '{listener_module.module}' failed." - raise DataError(message) - return listener - - def _string_to_modules(self, modules): - Module = namedtuple("Module", "module, args, kw_args") - parsed_modules = [] - for module in modules.split(","): - module = module.strip() - module_and_args = module.split(";") - module_name = module_and_args.pop(0) - kw_args = {} - args = [] - for argument in module_and_args: - if "=" in argument: - key, value = argument.split("=") - kw_args[key] = value - else: - args.append(argument) - module = Module(module=module_name, args=args, kw_args=kw_args) - parsed_modules.append(module) - return parsed_modules - - def _store_plugin_keywords(self, plugin): - dynamic_core = DynamicCore([plugin]) - self._plugin_keywords.extend(dynamic_core.get_keyword_names()) - - def _resolve_screenshot_root_directory(self): - screenshot_root_directory = self.screenshot_root_directory - if is_string(screenshot_root_directory): - if screenshot_root_directory.upper() == EMBED: - self.screenshot_root_directory = EMBED +# Copyright 2008-2011 Nokia Networks +# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors +# Copyright 2016- Robot Framework Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from collections import namedtuple +from datetime import timedelta +from inspect import getdoc, isclass +from typing import Optional, List + +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 +from selenium.webdriver.remote.webdriver import WebDriver +from selenium.webdriver.remote.webelement import WebElement + +from SeleniumLibrary.base import LibraryComponent +from SeleniumLibrary.errors import NoOpenBrowser, PluginError +from SeleniumLibrary.keywords import ( + AlertKeywords, + BrowserManagementKeywords, + CookieKeywords, + ElementKeywords, + FormElementKeywords, + FrameKeywords, + JavaScriptKeywords, + RunOnFailureKeywords, + ScreenshotKeywords, + SelectElementKeywords, + TableElementKeywords, + WaitingKeywords, + WebDriverCache, + WindowKeywords, +) +from SeleniumLibrary.keywords.screenshot import EMBED +from SeleniumLibrary.locators import ElementFinder +from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay + + +__version__ = "6.1.0rc1" + + +class SeleniumLibrary(DynamicCore): + """SeleniumLibrary is a web testing library for Robot Framework. + + This document explains how to use keywords provided by SeleniumLibrary. + For information about installation, support, and more, please visit the + [https://github.com/robotframework/SeleniumLibrary|project pages]. + For more information about Robot Framework, see http://robotframework.org. + + SeleniumLibrary uses the Selenium WebDriver modules internally to + control a web browser. See http://seleniumhq.org for more information + about Selenium in general and SeleniumLibrary README.rst + [https://github.com/robotframework/SeleniumLibrary#browser-drivers|Browser drivers chapter] + for more details about WebDriver binary installation. + + %TOC% + + = Locating elements = + + All keywords in SeleniumLibrary that need to interact with an element + on a web page take an argument typically named ``locator`` that specifies + how to find the element. Most often the locator is given as a string + using the locator syntax described below, but `using WebElements` is + possible too. + + == Locator syntax == + + SeleniumLibrary supports finding elements based on different strategies + such as the element id, XPath expressions, or CSS selectors. The strategy + can either be explicitly specified with a prefix or the strategy can be + implicit. + + === Default locator strategy === + + By default, locators are considered to use the keyword specific default + locator strategy. All keywords support finding elements based on ``id`` + and ``name`` attributes, but some keywords support additional attributes + or other values that make sense in their context. For example, `Click + Link` supports the ``href`` attribute and the link text and addition + to the normal ``id`` and ``name``. + + Examples: + + | `Click Element` | example | # Match based on ``id`` or ``name``. | + | `Click Link` | example | # Match also based on link text and ``href``. | + | `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. | + + If a locator accidentally starts with a prefix recognized as `explicit + locator strategy` or `implicit XPath strategy`, it is possible to use + the explicit ``default`` prefix to enable the default strategy. + + Examples: + + | `Click Element` | name:foo | # Find element with name ``foo``. | + | `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. | + | `Click Element` | //foo | # Find element using XPath ``//foo``. | + | `Click Element` | default: //foo | # Use default strategy with value ``//foo``. | + + === Explicit locator strategy === + + The explicit locator strategy is specified with a prefix using either + syntax ``strategy:value`` or ``strategy=value``. The former syntax + is preferred because the latter is identical to Robot Framework's + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-argument-syntax| + named argument syntax] and that can cause problems. Spaces around + the separator are ignored, so ``id:foo``, ``id: foo`` and ``id : foo`` + are all equivalent. + + Locator strategies that are supported by default are listed in the table + below. In addition to them, it is possible to register `custom locators`. + + | = Strategy = | = Match based on = | = Example = | + | id | Element ``id``. | ``id:example`` | + | name | ``name`` attribute. | ``name:example`` | + | identifier | Either ``id`` or ``name``. | ``identifier:example`` | + | class | Element ``class``. | ``class:example`` | + | tag | Tag name. | ``tag:div`` | + | xpath | XPath expression. | ``xpath://div[@id="example"]`` | + | css | CSS selector. | ``css:div#example`` | + | dom | DOM expression. | ``dom:document.images[5]`` | + | link | Exact text a link has. | ``link:The example`` | + | partial link | Partial link text. | ``partial link:he ex`` | + | sizzle | Sizzle selector deprecated. | ``sizzle:div.example`` | + | data | Element ``data-*`` attribute | ``data:id:my_id`` | + | jquery | jQuery expression. | ``jquery:div.example`` | + | default | Keyword specific default behavior. | ``default:example`` | + + See the `Default locator strategy` section below for more information + about how the default strategy works. Using the explicit ``default`` + prefix is only necessary if the locator value itself accidentally + matches some of the explicit strategies. + + Different locator strategies have different pros and cons. Using ids, + either explicitly like ``id:foo`` or by using the `default locator + strategy` simply like ``foo``, is recommended when possible, because + the syntax is simple and locating elements by id is fast for browsers. + If an element does not have an id or the id is not stable, other + solutions need to be used. If an element has a unique tag name or class, + using ``tag``, ``class`` or ``css`` strategy like ``tag:h1``, + ``class:example`` or ``css:h1.example`` is often an easy solution. In + more complex cases using XPath expressions is typically the best + approach. They are very powerful but a downside is that they can also + get complex. + + Examples: + + | `Click Element` | id:foo | # Element with id 'foo'. | + | `Click Element` | css:div#foo h1 | # h1 element under div with id 'foo'. | + | `Click Element` | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. | + | `Click Element` | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. | + + *NOTE:* + + - The ``strategy:value`` syntax is only supported by SeleniumLibrary 3.0 + and newer. + - Using the ``sizzle`` strategy or its alias ``jquery`` requires that + the system under test contains the jQuery library. + - Prior to SeleniumLibrary 3.0, table related keywords only supported + ``xpath``, ``css`` and ``sizzle/jquery`` strategies. + - ``data`` strategy is conveniance locator that will construct xpath from the parameters. + If you have element like `
`, you locate the element via + ``data:automation:automation-id-2``. This feature was added in SeleniumLibrary 5.2.0 + + === Implicit XPath strategy === + + If the locator starts with ``//`` or multiple opening parenthesis in front + of the ``//``, the locator is considered to be an XPath expression. In other + words, using ``//div`` is equivalent to using explicit ``xpath://div`` and + ``((//div))`` is equivalent to using explicit ``xpath:((//div))`` + + Examples: + + | `Click Element` | //div[@id="foo"]//h1 | + | `Click Element` | (//div)[2] | + + The support for the ``(//`` prefix is new in SeleniumLibrary 3.0. + Supporting multiple opening parenthesis is new in SeleniumLibrary 5.0. + + === Chaining locators === + + It is possible chain multiple locators together as single locator. Each chained locator must start with locator + strategy. Chained locators must be separated with single space, two greater than characters and followed with + space. It is also possible mix different locator strategies, example css or xpath. Also a list can also be + used to specify multiple locators. This is useful, is some part of locator would match as the locator separator + but it should not. Or if there is need to existing WebElement as locator. + + Although all locators support chaining, some locator strategies do not abey the chaining. This is because + some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context + and not for the element found be the previous locator. Chaining is supported by locator strategies which + are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery + + Examples: + | `Click Element` | css:.bar >> xpath://a | # To find a link which is present after an element with class "bar" | + + List examples: + | ${locator_list} = | `Create List` | css:div#div_id | xpath://*[text(), " >> "] | + | `Page Should Contain Element` | ${locator_list} | | | + | ${element} = | Get WebElement | xpath://*[text(), " >> "] | | + | ${locator_list} = | `Create List` | css:div#div_id | ${element} | + | `Page Should Contain Element` | ${locator_list} | | | + + Chaining locators in new in SeleniumLibrary 5.0 + + == Using WebElements == + + In addition to specifying a locator as a string, it is possible to use + Selenium's WebElement objects. This requires first getting a WebElement, + for example, by using the `Get WebElement` keyword. + + | ${elem} = | `Get WebElement` | id:example | + | `Click Element` | ${elem} | | + + == Custom locators == + + If more complex lookups are required than what is provided through the + default locators, custom lookup strategies can be created. Using custom + locators is a two part process. First, create a keyword that returns + a WebElement that should be acted on: + + | Custom Locator Strategy | [Arguments] | ${browser} | ${locator} | ${tag} | ${constraints} | + | | ${element}= | Execute Javascript | return window.document.getElementById('${locator}'); | + | | [Return] | ${element} | + + This keyword is a reimplementation of the basic functionality of the + ``id`` locator where ``${browser}`` is a reference to a WebDriver + instance and ``${locator}`` is the name of the locator strategy. To use + this locator, it must first be registered by using the + `Add Location Strategy` keyword: + + | `Add Location Strategy` | custom | Custom Locator Strategy | + + The first argument of `Add Location Strategy` specifies the name of + the strategy and it must be unique. After registering the strategy, + the usage is the same as with other locators: + + | `Click Element` | custom:example | + + See the `Add Location Strategy` keyword for more details. + + = Browser and Window = + + There is different conceptual meaning when SeleniumLibrary talks + about windows or browsers. This chapter explains those differences. + + == Browser == + + When `Open Browser` or `Create WebDriver` keyword is called, it + will create a new Selenium WebDriver instance by using the + [https://www.seleniumhq.org/docs/03_webdriver.jsp|Selenium WebDriver] + API. In SeleniumLibrary terms, a new browser is created. It is + possible to start multiple independent browsers (Selenium Webdriver + instances) at the same time, by calling `Open Browser` or + `Create WebDriver` multiple times. These browsers are usually + independent of each other and do not share data like cookies, + sessions or profiles. Typically when the browser starts, it + creates a single window which is shown to the user. + + == Window == + + Windows are the part of a browser that loads the web site and presents + it to the user. All content of the site is the content of the window. + Windows are children of a browser. In SeleniumLibrary browser is a + synonym for WebDriver instance. One browser may have multiple + windows. Windows can appear as tabs, as separate windows or pop-ups with + different position and size. Windows belonging to the same browser + typically share the sessions detail, like cookies. If there is a + need to separate sessions detail, example login with two different + users, two browsers (Selenium WebDriver instances) must be created. + New windows can be opened example by the application under test or + by example `Execute Javascript` keyword: + + | `Execute Javascript` window.open() # Opens a new window with location about:blank + + The example below opens multiple browsers and windows, + to demonstrate how the different keywords can be used to interact + with browsers, and windows attached to these browsers. + + Structure: + | BrowserA + | Window 1 (location=https://robotframework.org/) + | Window 2 (location=https://robocon.io/) + | Window 3 (location=https://github.com/robotframework/) + | + | BrowserB + | Window 1 (location=https://github.com/) + + Example: + | `Open Browser` | https://robotframework.org | ${BROWSER} | alias=BrowserA | # BrowserA with first window is opened. | + | `Execute Javascript` | window.open() | | | # In BrowserA second window is opened. | + | `Switch Window` | locator=NEW | | | # Switched to second window in BrowserA | + | `Go To` | https://robocon.io | | | # Second window navigates to robocon site. | + | `Execute Javascript` | window.open() | | | # In BrowserA third window is opened. | + | ${handle} | `Switch Window` | locator=NEW | | # Switched to third window in BrowserA | + | `Go To` | https://github.com/robotframework/ | | | # Third windows goes to robot framework github site. | + | `Open Browser` | https://github.com | ${BROWSER} | alias=BrowserB | # BrowserB with first windows is opened. | + | ${location} | `Get Location` | | | # ${location} is: https://www.github.com | + | `Switch Window` | ${handle} | browser=BrowserA | | # BrowserA second windows is selected. | + | ${location} | `Get Location` | | | # ${location} = https://robocon.io/ | + | @{locations 1} | `Get Locations` | | | # By default, lists locations under the currectly active browser (BrowserA). | + | @{locations 2} | `Get Locations` | browser=ALL | | # By using browser=ALL argument keyword list all locations from all browsers. | + + The above example, @{locations 1} contains the following items: + https://robotframework.org/, https://robocon.io/ and + https://github.com/robotframework/'. The @{locations 2} + contains the following items: https://robotframework.org/, + https://robocon.io/, https://github.com/robotframework/' + and 'https://github.com/. + + = Timeouts, waits, and delays = + + This section discusses different ways how to wait for elements to + appear on web pages and to slow down execution speed otherwise. + It also explains the `time format` that can be used when setting various + timeouts, waits, and delays. + + == Timeout == + + SeleniumLibrary contains various keywords that have an optional + ``timeout`` argument that specifies how long these keywords should + wait for certain events or actions. These keywords include, for example, + ``Wait ...`` keywords and keywords related to alerts. Additionally + `Execute Async Javascript`. Although it does not have ``timeout``, + argument, uses a timeout to define how long asynchronous JavaScript + can run. + + The default timeout these keywords use can be set globally either by + using the `Set Selenium Timeout` keyword or with the ``timeout`` argument + when `importing` the library. If no default timeout is set globally, the + default is 5 seconds. If None is specified for the timeout argument in the + keywords, the default is used. See `time format` below for supported + timeout syntax. + + == Implicit wait == + + Implicit wait specifies the maximum time how long Selenium waits when + searching for elements. It can be set by using the `Set Selenium Implicit + Wait` keyword or with the ``implicit_wait`` argument when `importing` + the library. See [https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp| + Selenium documentation] for more information about this functionality. + + See `time format` below for supported syntax. + + == Page load == + Page load timeout is the amount of time to wait for page load to complete until error is raised. + + The default page load timeout can be set globally + when `importing` the library with the ``page_load_timeout`` argument + or by using the `Set Selenium Page Load Timeout` keyword. + + See `time format` below for supported timeout syntax. + + Support for page load is new in SeleniumLibrary 6.1 + + == Selenium speed == + + Selenium execution speed can be slowed down globally by using `Set + Selenium speed` keyword. This functionality is designed to be used for + demonstrating or debugging purposes. Using it to make sure that elements + appear on a page is not a good idea. The above-explained timeouts + and waits should be used instead. + + See `time format` below for supported syntax. + + == Time format == + + All timeouts and waits can be given as numbers considered seconds + (e.g. ``0.5`` or ``42``) or in Robot Framework's time syntax + (e.g. ``1.5 seconds`` or ``1 min 30 s``). For more information about + the time syntax see the + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format|Robot Framework User Guide]. + + = Run-on-failure functionality = + + SeleniumLibrary has a handy feature that it can automatically execute + a keyword if any of its own keywords fails. By default, it uses the + `Capture Page Screenshot` keyword, but this can be changed either by + using the `Register Keyword To Run On Failure` keyword or with the + ``run_on_failure`` argument when `importing` the library. It is + possible to use any keyword from any imported library or resource file. + + The run-on-failure functionality can be disabled by using a special value + ``NOTHING`` or anything considered false (see `Boolean arguments`) + such as ``NONE``. + + = Boolean arguments = + + Starting from 5.0 SeleniumLibrary relies on Robot Framework to perform the + boolean conversion based on keyword arguments [https://docs.python.org/3/library/typing.html|type hint]. + More details in Robot Framework + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#supported-conversions|user guide] + + Please note SeleniumLibrary 3 and 4 did have own custom methods to covert + arguments to boolean values. + + = EventFiringWebDriver = + + The SeleniumLibrary offers support for + [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver]. + See the Selenium and SeleniumLibrary + [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#EventFiringWebDriver|EventFiringWebDriver support] + documentation for further details. + + EventFiringWebDriver is new in SeleniumLibrary 4.0 + + = Thread support = + + SeleniumLibrary is not thread-safe. This is mainly due because the underlying + [https://github.com/SeleniumHQ/selenium/wiki/Frequently-Asked-Questions#q-is-webdriver-thread-safe| + Selenium tool is not thread-safe] within one browser/driver instance. + Because of the limitation in the Selenium side, the keywords or the + API provided by the SeleniumLibrary is not thread-safe. + + = Plugins = + + SeleniumLibrary offers plugins as a way to modify and add library keywords and modify some of the internal + functionality without creating a new library or hacking the source code. See + [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#Plugins|plugin API] + documentation for further details. + + Plugin API is new SeleniumLibrary 4.0 + """ + + ROBOT_LIBRARY_SCOPE = "GLOBAL" + ROBOT_LIBRARY_VERSION = __version__ + + def __init__( + self, + timeout=timedelta(seconds=5), + implicit_wait=timedelta(seconds=0), + run_on_failure="Capture Page Screenshot", + screenshot_root_directory: Optional[str] = None, + plugins: Optional[str] = None, + event_firing_webdriver: Optional[str] = None, + page_load_timeout=timedelta(minutes=5), + action_chain_delay=timedelta(seconds=0.25), + ): + """SeleniumLibrary can be imported with several optional arguments. + + - ``timeout``: + Default value for `timeouts` used with ``Wait ...`` keywords. + - ``implicit_wait``: + Default value for `implicit wait` used when locating elements. + - ``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. + If not given, the directory where the log file is written is used. + - ``plugins``: + Allows extending the SeleniumLibrary with external Python classes. + - ``event_firing_webdriver``: + Class for wrapping Selenium with + [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] + - ``page_load_timeout``: + Default value to wait for page load to complete until error is raised. + - ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. + """ + self.timeout = _convert_timeout(timeout) + self.implicit_wait = _convert_timeout(implicit_wait) + self.action_chain_delay = _convert_delay(action_chain_delay) + self.page_load_timeout = _convert_timeout(page_load_timeout) + self.speed = 0.0 + self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( + run_on_failure + ) + self._running_on_failure_keyword = False + self.screenshot_root_directory = screenshot_root_directory + self._resolve_screenshot_root_directory() + self._element_finder = ElementFinder(self) + self._plugin_keywords = [] + libraries = [ + AlertKeywords(self), + BrowserManagementKeywords(self), + CookieKeywords(self), + ElementKeywords(self), + FormElementKeywords(self), + FrameKeywords(self), + JavaScriptKeywords(self), + RunOnFailureKeywords(self), + ScreenshotKeywords(self), + SelectElementKeywords(self), + TableElementKeywords(self), + WaitingKeywords(self), + WindowKeywords(self), + ] + self.ROBOT_LIBRARY_LISTENER = LibraryListener() + self._running_keyword = None + self.event_firing_webdriver = None + if is_truthy(event_firing_webdriver): + self.event_firing_webdriver = self._parse_listener(event_firing_webdriver) + self._plugins = [] + if is_truthy(plugins): + plugin_libs = self._parse_plugins(plugins) + self._plugins = plugin_libs + libraries = libraries + plugin_libs + self._drivers = WebDriverCache() + DynamicCore.__init__(self, libraries) + + def run_keyword(self, name: str, args: tuple, kwargs: dict): + try: + return DynamicCore.run_keyword(self, name, args, kwargs) + except Exception: + self.failure_occurred() + raise + + def get_keyword_tags(self, name: str) -> list: + tags = list(DynamicCore.get_keyword_tags(self, name)) + if name in self._plugin_keywords: + tags.append("plugin") + return tags + + def get_keyword_documentation(self, name: str) -> str: + if name == "__intro__": + return self._get_intro_documentation() + return DynamicCore.get_keyword_documentation(self, name) + + def _parse_plugin_doc(self): + Doc = namedtuple("Doc", "doc, name") + for plugin in self._plugins: + yield Doc( + doc=getdoc(plugin) or "No plugin documentation found.", + name=plugin.__class__.__name__, + ) + + def _get_intro_documentation(self): + intro = DynamicCore.get_keyword_documentation(self, "__intro__") + for plugin_doc in self._parse_plugin_doc(): + intro = f"{intro}\n\n" + intro = f"{intro}= Plugin: {plugin_doc.name} =\n\n" + intro = f"{intro}{plugin_doc.doc}" + return intro + + def register_driver(self, driver: WebDriver, alias: str): + """Add's a `driver` to the library WebDriverCache. + + :param driver: Instance of the Selenium `WebDriver`. + :type driver: selenium.webdriver.remote.webdriver.WebDriver + :param alias: Alias given for this `WebDriver` instance. + :type alias: str + :return: The index of the `WebDriver` instance. + :rtype: int + """ + return self._drivers.register(driver, alias) + + def failure_occurred(self): + """Method that is executed when a SeleniumLibrary keyword fails. + + By default, executes the registered run-on-failure keyword. + Libraries extending SeleniumLibrary can overwrite this hook + method if they want to provide custom functionality instead. + """ + if self._running_on_failure_keyword or not self.run_on_failure_keyword: + return + try: + self._running_on_failure_keyword = True + if self.run_on_failure_keyword.lower() == "capture page screenshot": + self.capture_page_screenshot() + else: + BuiltIn().run_keyword(self.run_on_failure_keyword) + except Exception as err: + logger.warn( + f"Keyword '{self.run_on_failure_keyword}' could not be run on failure: {err}" + ) + finally: + self._running_on_failure_keyword = False + + @property + def driver(self) -> WebDriver: + """Current active driver. + + :rtype: selenium.webdriver.remote.webdriver.WebDriver + :raises SeleniumLibrary.errors.NoOpenBrowser: If browser is not open. + """ + if not self._drivers.current: + raise NoOpenBrowser("No browser is open.") + return self._drivers.current + + def find_element( + self, locator: str, parent: Optional[WebElement] = None + ) -> WebElement: + """Find element matching `locator`. + + :param locator: Locator to use when searching the element. + See library documentation for the supported locator syntax. + :type locator: str or selenium.webdriver.remote.webelement.WebElement + :param parent: Optional parent `WebElememt` to search child elements + from. By default, search starts from the root using `WebDriver`. + :type parent: selenium.webdriver.remote.webelement.WebElement + :return: Found `WebElement`. + :rtype: selenium.webdriver.remote.webelement.WebElement + :raises SeleniumLibrary.errors.ElementNotFound: If element not found. + """ + return self._element_finder.find(locator, parent=parent) + + def find_elements( + self, locator: str, parent: WebElement = None + ) -> List[WebElement]: + """Find all elements matching `locator`. + + :param locator: Locator to use when searching the element. + See library documentation for the supported locator syntax. + :type locator: str or selenium.webdriver.remote.webelement.WebElement + :param parent: Optional parent `WebElememt` to search child elements + from. By default, search starts from the root using `WebDriver`. + :type parent: selenium.webdriver.remote.webelement.WebElement + :return: list of found `WebElement` or e,mpty if elements are not found. + :rtype: list[selenium.webdriver.remote.webelement.WebElement] + """ + return self._element_finder.find( + locator, first_only=False, required=False, parent=parent + ) + + def _parse_plugins(self, plugins): + libraries = [] + importer = Importer("test library") + for parsed_plugin in self._string_to_modules(plugins): + plugin = importer.import_class_or_module(parsed_plugin.module) + if not isclass(plugin): + message = f"Importing test library: '{parsed_plugin.module}' failed." + raise DataError(message) + plugin = plugin(self, *parsed_plugin.args, **parsed_plugin.kw_args) + if not isinstance(plugin, LibraryComponent): + message = ( + "Plugin does not inherit SeleniumLibrary.base.LibraryComponent" + ) + raise PluginError(message) + self._store_plugin_keywords(plugin) + libraries.append(plugin) + return libraries + + def _parse_listener(self, event_firing_webdriver): + listener_module = self._string_to_modules(event_firing_webdriver) + listener_count = len(listener_module) + if listener_count > 1: + message = f"Is is possible import only one listener but there was {listener_count} listeners." + raise ValueError(message) + listener_module = listener_module[0] + importer = Importer("test library") + listener = importer.import_class_or_module(listener_module.module) + if not isclass(listener): + message = f"Importing test Selenium lister class '{listener_module.module}' failed." + raise DataError(message) + return listener + + def _string_to_modules(self, modules): + Module = namedtuple("Module", "module, args, kw_args") + parsed_modules = [] + for module in modules.split(","): + module = module.strip() + module_and_args = module.split(";") + module_name = module_and_args.pop(0) + kw_args = {} + args = [] + for argument in module_and_args: + if "=" in argument: + key, value = argument.split("=") + kw_args[key] = value + else: + args.append(argument) + module = Module(module=module_name, args=args, kw_args=kw_args) + parsed_modules.append(module) + return parsed_modules + + def _store_plugin_keywords(self, plugin): + dynamic_core = DynamicCore([plugin]) + self._plugin_keywords.extend(dynamic_core.get_keyword_names()) + + def _resolve_screenshot_root_directory(self): + screenshot_root_directory = self.screenshot_root_directory + if is_string(screenshot_root_directory): + if screenshot_root_directory.upper() == EMBED: + self.screenshot_root_directory = EMBED From 55b4cdf83d0e5f96e257ce7eddd8ef9d49722a22 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 28 Apr 2023 09:01:40 -0400 Subject: [PATCH 063/407] Generate stub file for 6.1.0rc1 --- src/SeleniumLibrary/__init__.pyi | 412 ++++++++++++++++--------------- 1 file changed, 208 insertions(+), 204 deletions(-) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index cf36fe8c5..eedbad5ab 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -1,204 +1,208 @@ -from datetime import timedelta -from typing import Any, Optional, Union - -import selenium -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement - -class SeleniumLibrary: - def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), action_chain_delay(seconds=0.25)), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Union[str, None]] = None, plugins: Optional[Union[str, None]] = None, event_firing_webdriver: Optional[Union[str, None]] = None): ... - def add_cookie(self, name: str, value: str, path: Optional[Union[str, None]] = None, domain: Optional[Union[str, None]] = None, secure: Optional[Union[bool, None]] = None, expiry: Optional[Union[str, None]] = None): ... - def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... - def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Union[datetime.timedelta, None]] = None): ... - def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Union[datetime.timedelta, None]] = None): ... - def assign_id_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], id: str): ... - def capture_element_screenshot(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], filename: str = 'selenium-element-screenshot-{index}.png'): ... - def capture_page_screenshot(self, filename: str = 'selenium-screenshot-{index}.png'): ... - def checkbox_should_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def checkbox_should_not_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def choose_file(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], file_path: str): ... - def clear_element_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def click_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... - def click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False, action_chain: bool = False): ... - def click_element_at_coordinates(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... - def click_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... - def click_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... - def close_all_browsers(self): ... - def close_browser(self): ... - def close_window(self): ... - def cover_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def create_webdriver(self, driver_name: str, alias: Optional[Union[str, None]] = None, kwargs = {}, **init_kwargs): ... - def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... - def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... - def delete_all_cookies(self): ... - def delete_cookie(self, name): ... - def double_click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def drag_and_drop(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], target: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def drag_and_drop_by_offset(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... - def element_attribute_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str, expected: Union[None, str], message: Optional[Union[str, None]] = None): ... - def element_should_be_disabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_focused(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None): ... - def element_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Union[None, str], message: Optional[Union[str, None]] = None, ignore_case: bool = False): ... - def element_should_not_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None): ... - def element_should_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Union[None, str], message: Optional[Union[str, None]] = None, ignore_case: bool = False): ... - def element_text_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Union[None, str], message: Optional[Union[str, None]] = None, ignore_case: bool = False): ... - def element_text_should_not_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], not_expected: Union[None, str], message: Optional[Union[str, None]] = None, ignore_case: bool = False): ... - def execute_async_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def execute_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def frame_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, loglevel: str = 'TRACE'): ... - def get_all_links(self): ... - def get_browser_aliases(self): ... - def get_browser_ids(self): ... - def get_cookie(self, name: str): ... - def get_cookies(self, as_dict: bool = False): ... - def get_element_attribute(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str): ... - def get_element_count(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_element_size(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_horizontal_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_list_items(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], values: bool = False): ... - def get_location(self): ... - def get_locations(self, browser: str = 'CURRENT'): ... - def get_selected_list_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_labels(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_values(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selenium_implicit_wait(self): ... - def get_selenium_speed(self): ... - def get_selenium_timeout(self): ... - def get_session_id(self): ... - def get_source(self): ... - def get_table_cell(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, loglevel: str = 'TRACE'): ... - def get_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_title(self): ... - def get_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_vertical_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_webelement(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_webelements(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_window_handles(self, browser: str = 'CURRENT'): ... - def get_window_identifiers(self, browser: str = 'CURRENT'): ... - def get_window_names(self, browser: str = 'CURRENT'): ... - def get_window_position(self): ... - def get_window_size(self, inner: bool = False): ... - def get_window_titles(self, browser: str = 'CURRENT'): ... - def go_back(self): ... - def go_to(self, url): ... - def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Union[datetime.timedelta, None]] = None): ... - def input_password(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], password: str, clear: bool = True): ... - def input_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, clear: bool = True): ... - def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Union[datetime.timedelta, None]] = None): ... - def list_selection_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *expected: str): ... - def list_should_have_no_selections(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def location_should_be(self, url: str, message: Optional[Union[str, None]] = None): ... - def location_should_contain(self, expected: str, message: Optional[Union[str, None]] = None): ... - def log_location(self): ... - def log_source(self, loglevel: str = 'INFO'): ... - def log_title(self): ... - def maximize_browser_window(self): ... - def mouse_down(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_down_on_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_down_on_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_out(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_over(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_up(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def open_browser(self, url: Optional[Union[str, None]] = None, browser: str = 'firefox', alias: Optional[Union[str, None]] = None, remote_url: Union[bool, str] = False, desired_capabilities: Optional[Union[dict, None, str]] = None, ff_profile_dir: Optional[Union[selenium.webdriver.firefox.firefox_profile.FirefoxProfile, str, None]] = None, options: Optional[Union[typing.Any, None]] = None, service_log_path: Optional[Union[str, None]] = None, executable_path: Optional[Union[str, None]] = None): ... - def open_context_menu(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE', limit: Optional[Union[int, None]] = None): ... - def page_should_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_not_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Union[str, None]] = None, loglevel: str = 'TRACE'): ... - def press_key(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], key: str): ... - def press_keys(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None, *keys: str): ... - def radio_button_should_be_set_to(self, group_name: str, value: str): ... - def radio_button_should_not_be_selected(self, group_name: str): ... - def register_keyword_to_run_on_failure(self, keyword: Union[str, None]): ... - def reload_page(self): ... - def remove_location_strategy(self, strategy_name: str): ... - def scroll_element_into_view(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_frame(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... - def select_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... - def select_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... - def select_radio_button(self, group_name: str, value: str): ... - def set_browser_implicit_wait(self, value: timedelta): ... - def set_focus_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def set_screenshot_directory(self, path: Union[None, str]): ... - def set_selenium_implicit_wait(self, value: timedelta): ... - def set_selenium_speed(self, value: timedelta): ... - def set_selenium_timeout(self, value: timedelta): ... - def set_window_position(self, x: int, y: int): ... - def set_window_size(self, width: int, height: int, inner: bool = False): ... - def simulate_event(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], event: str): ... - def submit_form(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None): ... - def switch_browser(self, index_or_alias: str): ... - def switch_window(self, locator: Union[list, str] = 'MAIN', timeout: Optional[Union[str, None]] = None, browser: str = 'CURRENT'): ... - def table_cell_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_column_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_footer_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def table_header_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def table_row_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, expected: str, loglevel: str = 'TRACE'): ... - def table_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def textarea_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Union[str, None]] = None): ... - def textarea_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Union[str, None]] = None): ... - def textfield_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Union[str, None]] = None): ... - def textfield_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Union[str, None]] = None): ... - def title_should_be(self, title: str, message: Optional[Union[str, None]] = None): ... - def unselect_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def unselect_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def unselect_frame(self): ... - def unselect_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... - def unselect_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... - def unselect_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... - def wait_for_condition(self, condition: str, timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_element_contains(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_element_does_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_element_is_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_element_is_not_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_element_is_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_location_contains(self, expected: str, timeout: Optional[Union[datetime.timedelta, None]] = None, message: Optional[Union[str, None]] = None): ... - def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Union[datetime.timedelta, None]] = None, message: Optional[Union[str, None]] = None): ... - def wait_until_location_is(self, expected: str, timeout: Optional[Union[datetime.timedelta, None]] = None, message: Optional[Union[str, None]] = None): ... - def wait_until_location_is_not(self, location: str, timeout: Optional[Union[datetime.timedelta, None]] = None, message: Optional[Union[str, None]] = None): ... - def wait_until_page_contains(self, text: str, timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_page_contains_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None, limit: Optional[Union[int, None]] = None): ... - def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None): ... - def wait_until_page_does_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Union[datetime.timedelta, None]] = None, error: Optional[Union[str, None]] = None, limit: Optional[Union[int, None]] = None): ... - # methods from library. - def add_library_components(self, library_components): ... - def get_keyword_names(self): ... - def run_keyword(self, name: str, args: tuple, kwargs: Optional[dict] = None): ... - def get_keyword_arguments(self, name: str): ... - def get_keyword_tags(self, name: str): ... - def get_keyword_documentation(self, name: str): ... - def get_keyword_types(self, name: str): ... - def get_keyword_source(self, keyword_name: str): ... - def failure_occurred(self): ... - def register_driver(self, driver: WebDriver, alias: str): ... - @property - def driver(self) -> WebDriver: ... - def find_element(self, locator: str, parent: Optional[WebElement] = None): ... - def find_elements(self, locator: str, parent: WebElement = None): ... - def _parse_plugins(self, plugins: Any): ... - def _parse_plugin_doc(self): ... - def _get_intro_documentation(self): ... - def _parse_listener(self, event_firing_webdriver: Any): ... - def _string_to_modules(self, modules: Any): ... - def _store_plugin_keywords(self, plugin): ... - def _resolve_screenshot_root_directory(self): ... +from datetime import timedelta +from typing import Any, Optional, Union + +import selenium +from selenium.webdriver.remote.webdriver import WebDriver +from selenium.webdriver.remote.webelement import WebElement + +class SeleniumLibrary: + def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional[str]] = None, plugins: Optional[Optional[str]] = None, event_firing_webdriver: Optional[Optional[str]] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25)): ... + def add_cookie(self, name: str, value: str, path: Optional[Optional[str]] = None, domain: Optional[Optional[str]] = None, secure: Optional[Optional[bool]] = None, expiry: Optional[Optional[str]] = None): ... + def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... + def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... + def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... + def assign_id_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], id: str): ... + def capture_element_screenshot(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], filename: str = 'selenium-element-screenshot-{index}.png'): ... + def capture_page_screenshot(self, filename: str = 'selenium-screenshot-{index}.png'): ... + def checkbox_should_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def checkbox_should_not_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def choose_file(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], file_path: str): ... + def clear_element_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def click_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... + def click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False, action_chain: bool = False): ... + def click_element_at_coordinates(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... + def click_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... + def click_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... + def close_all_browsers(self): ... + def close_browser(self): ... + def close_window(self): ... + def cover_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def create_webdriver(self, driver_name: str, alias: Optional[Optional[str]] = None, kwargs = {}, **init_kwargs): ... + def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... + def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... + def delete_all_cookies(self): ... + def delete_cookie(self, name): ... + def double_click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def drag_and_drop(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], target: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def drag_and_drop_by_offset(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... + def element_attribute_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str, expected: Optional[str], message: Optional[Optional[str]] = None): ... + def element_should_be_disabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def element_should_be_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def element_should_be_focused(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def element_should_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None): ... + def element_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... + def element_should_not_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None): ... + def element_should_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... + def element_text_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... + def element_text_should_not_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], not_expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... + def execute_async_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def execute_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def frame_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, loglevel: str = 'TRACE'): ... + def get_action_chain_delay(self): ... + def get_all_links(self): ... + def get_browser_aliases(self): ... + def get_browser_ids(self): ... + def get_cookie(self, name: str): ... + def get_cookies(self, as_dict: bool = False): ... + def get_element_attribute(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str): ... + def get_element_count(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_element_size(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_horizontal_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_list_items(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], values: bool = False): ... + def get_location(self): ... + def get_locations(self, browser: str = 'CURRENT'): ... + def get_selected_list_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_selected_list_labels(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_selected_list_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_selected_list_values(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_selenium_implicit_wait(self): ... + def get_selenium_page_load_timeout(self): ... + def get_selenium_speed(self): ... + def get_selenium_timeout(self): ... + def get_session_id(self): ... + def get_source(self): ... + def get_table_cell(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, loglevel: str = 'TRACE'): ... + def get_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_title(self): ... + def get_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_vertical_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_webelement(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_webelements(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_window_handles(self, browser: str = 'CURRENT'): ... + def get_window_identifiers(self, browser: str = 'CURRENT'): ... + def get_window_names(self, browser: str = 'CURRENT'): ... + def get_window_position(self): ... + def get_window_size(self, inner: bool = False): ... + def get_window_titles(self, browser: str = 'CURRENT'): ... + def go_back(self): ... + def go_to(self, url): ... + def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... + def input_password(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], password: str, clear: bool = True): ... + def input_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, clear: bool = True): ... + def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... + def list_selection_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *expected: str): ... + def list_should_have_no_selections(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def location_should_be(self, url: str, message: Optional[Optional[str]] = None): ... + def location_should_contain(self, expected: str, message: Optional[Optional[str]] = None): ... + def log_location(self): ... + def log_source(self, loglevel: str = 'INFO'): ... + def log_title(self): ... + def maximize_browser_window(self): ... + def mouse_down(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def mouse_down_on_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def mouse_down_on_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def mouse_out(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def mouse_over(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def mouse_up(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def open_browser(self, url: Optional[Optional[str]] = None, browser: str = 'firefox', alias: Optional[Optional[str]] = None, remote_url: Union[bool, str] = False, desired_capabilities: Optional[Union[dict, None, str]] = None, ff_profile_dir: Optional[Union[selenium.webdriver.firefox.firefox_profile.FirefoxProfile, str, None]] = None, options: Optional[Optional[typing.Any]] = None, service_log_path: Optional[Optional[str]] = None, executable_path: Optional[Optional[str]] = None): ... + def open_context_menu(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... + def page_should_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE', limit: Optional[Optional[int]] = None): ... + def page_should_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... + def page_should_not_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def press_key(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], key: str): ... + def press_keys(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None, *keys: str): ... + def radio_button_should_be_set_to(self, group_name: str, value: str): ... + def radio_button_should_not_be_selected(self, group_name: str): ... + def register_keyword_to_run_on_failure(self, keyword: Optional[str]): ... + def reload_page(self): ... + def remove_location_strategy(self, strategy_name: str): ... + def scroll_element_into_view(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def select_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def select_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def select_frame(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def select_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... + def select_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... + def select_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... + def select_radio_button(self, group_name: str, value: str): ... + def set_action_chain_delay(self, value: timedelta): ... + def set_browser_implicit_wait(self, value: timedelta): ... + def set_focus_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def set_screenshot_directory(self, path: Optional[str]): ... + def set_selenium_implicit_wait(self, value: timedelta): ... + def set_selenium_page_load_timeout(self, value: timedelta): ... + def set_selenium_speed(self, value: timedelta): ... + def set_selenium_timeout(self, value: timedelta): ... + def set_window_position(self, x: int, y: int): ... + def set_window_size(self, width: int, height: int, inner: bool = False): ... + def simulate_event(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], event: str): ... + def submit_form(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None): ... + def switch_browser(self, index_or_alias: str): ... + def switch_window(self, locator: Union[list, str] = 'MAIN', timeout: Optional[Optional[str]] = None, browser: str = 'CURRENT'): ... + def table_cell_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_column_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_footer_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... + def table_header_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... + def table_row_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, expected: str, loglevel: str = 'TRACE'): ... + def table_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... + def textarea_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... + def textarea_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... + def textfield_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... + def textfield_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... + def title_should_be(self, title: str, message: Optional[Optional[str]] = None): ... + def unselect_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def unselect_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def unselect_frame(self): ... + def unselect_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... + def unselect_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... + def unselect_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... + def wait_for_condition(self, condition: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_element_contains(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_element_does_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_element_is_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_element_is_not_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_element_is_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_location_contains(self, expected: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... + def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... + def wait_until_location_is(self, expected: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... + def wait_until_location_is_not(self, location: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... + def wait_until_page_contains(self, text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_page_contains_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None, limit: Optional[Optional[int]] = None): ... + def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... + def wait_until_page_does_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None, limit: Optional[Optional[int]] = None): ... + # methods from library. + def add_library_components(self, library_components): ... + def get_keyword_names(self): ... + def run_keyword(self, name: str, args: tuple, kwargs: Optional[dict] = None): ... + def get_keyword_arguments(self, name: str): ... + def get_keyword_tags(self, name: str): ... + def get_keyword_documentation(self, name: str): ... + def get_keyword_types(self, name: str): ... + def get_keyword_source(self, keyword_name: str): ... + def failure_occurred(self): ... + def register_driver(self, driver: WebDriver, alias: str): ... + @property + def driver(self) -> WebDriver: ... + def find_element(self, locator: str, parent: Optional[WebElement] = None): ... + def find_elements(self, locator: str, parent: WebElement = None): ... + def _parse_plugins(self, plugins: Any): ... + def _parse_plugin_doc(self): ... + def _get_intro_documentation(self): ... + def _parse_listener(self, event_firing_webdriver: Any): ... + def _string_to_modules(self, modules: Any): ... + def _store_plugin_keywords(self, plugin): ... + def _resolve_screenshot_root_directory(self): ... From 1fa70fe5df45edca2c330c0bda5267beee861262 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 28 Apr 2023 09:02:21 -0400 Subject: [PATCH 064/407] Generated docs for version 6.1.0rc1 --- docs/SeleniumLibrary.html | 3516 +++++++++++++++++++------------------ 1 file changed, 1832 insertions(+), 1684 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 75ccc3f3b..6ff4f5d40 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1,1684 +1,1832 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Opening library documentation failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + From d9c4f80fcf57ea8752f9b965f45315fee6ad2aae Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 28 Apr 2023 09:08:32 -0400 Subject: [PATCH 065/407] Regenerated project docs --- docs/index.html | 603 ++++++++++++++++++++++++------------------------ 1 file changed, 299 insertions(+), 304 deletions(-) diff --git a/docs/index.html b/docs/index.html index fbf15f30d..79dbb32e2 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,304 +1,299 @@ - - - - - -SeleniumLibrary - - - - -
-

SeleniumLibrary

- - -
-

Introduction

-

SeleniumLibrary is a web testing library for Robot Framework that -utilizes the Selenium tool internally. The project is hosted on GitHub -and downloads can be found from PyPI.

-

SeleniumLibrary works with Selenium 3 and 4. It supports Python 3.6 or -newer. In addition to the normal Python interpreter, it works also -with PyPy.

-

SeleniumLibrary is based on the old SeleniumLibrary that was forked to -Selenium2Library and then later renamed back to SeleniumLibrary. -See the Versions and History sections below for more information about -different versions and the overall project history.

-https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version -https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg -https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg -https://github.com/robotframework/SeleniumLibrary/workflows/SeleniumLibrary%20CI/badge.svg -
-
-

Keyword Documentation

-

See keyword documentation for available keywords and more information -about the library in general.

-
-
-

Installation

-

The recommended installation method is using pip:

-
pip install --upgrade robotframework-seleniumlibrary
-

Running this command installs also the latest Selenium and Robot Framework -versions, but you still need to install browser drivers separately. -The --upgrade option can be omitted when installing the library for the -first time.

-

Those migrating from Selenium2Library can install SeleniumLibrary so that -it is exposed also as Selenium2Library:

-
pip install --upgrade robotframework-selenium2library
-

The above command installs the normal SeleniumLibrary as well as a new -Selenium2Library version that is just a thin wrapper to SeleniumLibrary. -That allows importing Selenium2Library in tests while migrating to -SeleniumLibrary.

-

To install the last legacy Selenium2Library version, use this command instead:

-
pip install robotframework-selenium2library==1.8.0
-

With resent versions of pip it is possible to install directly from the -GitHub repository. To install latest source from the master branch, use -this command:

-
pip install git+https://github.com/robotframework/SeleniumLibrary.git
-

Please note that installation will take some time, because pip will -clone the SeleniumLibrary project to a temporary directory and then -perform the installation.

-

See Robot Framework installation instructions for detailed information -about installing Python and Robot Framework itself. For more details about -using pip see its own documentation.

-
-
-

Browser drivers

-

After installing the library, you still need to install browser and -operating system specific browser drivers for all those browsers you -want to use in tests. These are the exact same drivers you need to use with -Selenium also when not using SeleniumLibrary. More information about -drivers can be found from Selenium documentation.

-

The general approach to install a browser driver is downloading a right -driver, such as chromedriver for Chrome, and placing it into -a directory that is in PATH. Drivers for different browsers -can be found via Selenium documentation or by using your favorite -search engine with a search term like selenium chrome browser driver. -New browser driver versions are released to support features in -new browsers, fix bug, or otherwise, and you need to keep an eye on them -to know when to update drivers you use.

-

Alternatively, you can use a tool called WebdriverManager which can -find the latest version or when required, any version of appropriate -webdrivers for you and then download and link/copy it into right -location. Tool can run on all major operating systems and supports -downloading of Chrome, Firefox, Opera & Edge webdrivers.

-

Here's an example:

-
pip install webdrivermanager
-webdrivermanager firefox chrome --linkpath /usr/local/bin
-
-
-

Usage

-

To use SeleniumLibrary in Robot Framework tests, the library needs to -first be imported using the Library setting as any other library. -The library accepts some import time arguments, which are documented -in the keyword documentation along with all the keywords provided -by the library.

-

When using Robot Framework, it is generally recommended to write as -easy-to-understand tests as possible. The keywords provided by -SeleniumLibrary is pretty low level, though, and often require -implementation-specific arguments like element locators to be passed -as arguments. It is thus typically a good idea to write tests using -Robot Framework's higher-level keywords that utilize SeleniumLibrary -keywords internally. This is illustrated by the following example -where SeleniumLibrary keywords like Input Text are primarily -used by higher-level keywords like Input Username.

-
*** Settings ***
-Documentation     Simple example using SeleniumLibrary.
-Library           SeleniumLibrary
-
-*** Variables ***
-${LOGIN URL}      http://localhost:7272
-${BROWSER}        Chrome
-
-*** Test Cases ***
-Valid Login
-    Open Browser To Login Page
-    Input Username    demo
-    Input Password    mode
-    Submit Credentials
-    Welcome Page Should Be Open
-    [Teardown]    Close Browser
-
-*** Keywords ***
-Open Browser To Login Page
-    Open Browser    ${LOGIN URL}    ${BROWSER}
-    Title Should Be    Login Page
-
-Input Username
-    [Arguments]    ${username}
-    Input Text    username_field    ${username}
-
-Input Password
-    [Arguments]    ${password}
-    Input Text    password_field    ${password}
-
-Submit Credentials
-    Click Button    login_button
-
-Welcome Page Should Be Open
-    Title Should Be    Welcome Page
-

The above example is a slightly modified version of an example in a -demo project that illustrates using Robot Framework and SeleniumLibrary. -See the demo for more examples that you can also execute on your own -machine. For more information about Robot Framework test data syntax in -general see the Robot Framework User Guide.

-
-
-

Extending SeleniumLibrary

-

Before creating your own library which extends the SeleniumLibrary, please consider would -the extension be also useful also for general usage. If it could be useful also for general -usage, please create a new issue describing the enhancement request and even better if the -issue is backed up by a pull request.

-

If the enhancement is not generally useful, example solution is domain specific, then the -SeleniumLibrary offers public APIs which can be used to build its own plugins and libraries. -Plugin API allows us to add new keywords, modify existing keywords and modify the internal -functionality of the library. Also new libraries can be built on top of the -SeleniumLibrary. Please see extending documentation for more details about the -available methods and for examples how the library can be extended.

-
-
-

Community

-

If the provided documentation is not enough, there are various community channels -available:

- -
-
-

Versions

-

SeleniumLibrary has over the years lived under SeleniumLibrary and -Selenium2Library names and different library versions have supported -different Selenium and Python versions. This is summarized in the table -below and the History section afterwards explains the project history -a bit more.

- ------ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Project

Selenium Version

Python Version

Comment

SeleniumLibrary 2.9.2 and earlier

Selenium 1 and 2

Python 2.5-2.7

The original SeleniumLibrary using Selenium RC API.

Selenium2Library 1.8.0 and earlier

Selenium 2 and 3

Python 2.6-2.7

Fork of SeleniumLibrary using Selenium WebDriver API.

SeleniumLibrary 3.0 and 3.1

Selenium 2 and 3

Python 2.7 and 3.3+

Selenium2Library renamed and with Python 3 support and new architecture.

SeleniumLibrary 3.2

Selenium 3

Python 2.7 and 3.4+

Drops Selenium 2 support.

SeleniumLibrary 4.0

Selenium 3

Python 2.7 and 3.4+

Plugin API and support for event friging webdriver.

SeleniumLibrary 4.1

Selenium 3

Python 2.7 and 3.5+

Drops Python 3.4 support.

SeleniumLibrary 4.2

Selenium 3

Python 2.7 and 3.5+

Supports only Selenium 3.141.0 or newer.

SeleniumLibrary 4.4

Selenium 3 and 4

Python 2.7 and 3.6+

New PythonLibCore and dropped Python 3.5 support.

SeleniumLibrary 5.0

Selenium 3 and 4

Python 3.6+

Python 2 and Jython support is dropped.

SeleniumLibrary 5.1

Selenium 3 and 4

Python 3.6+

Robot Framework 3.1 support is dropped.

Selenium2Library 3.0

Depends on SeleniumLibrary

Depends on SeleniumLibrary

Thin wrapper for SeleniumLibrary 3.0 to ease transition.

-
-
-

History

-

SeleniumLibrary originally used the Selenium Remote Controller (RC) API. -When Selenium 2 was introduced with the new but backwards incompatible -WebDriver API, SeleniumLibrary kept using Selenium RC and separate -Selenium2Library using WebDriver was forked. These projects contained -mostly the same keywords and in most cases Selenium2Library was a drop-in -replacement for SeleniumLibrary.

-

Over the years development of the old SeleniumLibrary stopped and also -the Selenium RC API it used was deprecated. Selenium2Library was developed -further and replaced the old library as the de facto web testing library -for Robot Framework.

-

When Selenium 3 was released in 2016, it was otherwise backwards compatible -with Selenium 2, but the deprecated Selenium RC API was removed. This had two -important effects:

-
    -
  • The old SeleniumLibrary could not anymore be used with new Selenium versions. -This project was pretty much dead.

  • -
  • Selenium2Library was badly named as it supported Selenium 3 just fine. -This project needed a new name.

  • -
-

At the same time when Selenium 3 was released, Selenium2Library was going -through larger architecture changes in order to ease future maintenance and -to make adding Python 3 support easier. With all these big internal and -external changes, it made sense to rename Selenium2Library back to -SeleniumLibrary. This decision basically meant following changes:

-
    -
  • Create separate repository for the old SeleniumLibrary to preserve -its history since Selenium2Library was forked.

  • -
  • Rename Selenium2Library project and the library itself to SeleniumLibrary.

  • -
  • Add new Selenium2Library project to ease transitioning from Selenium2Library -to SeleniumLibrary.

  • -
-

Going forward, all new development will happen in the new SeleniumLibrary -project.

-
-
- - + + + + + + +SeleniumLibrary + + + + +
+

SeleniumLibrary

+ + +
+

Introduction

+

SeleniumLibrary is a web testing library for Robot Framework that +utilizes the Selenium tool internally. The project is hosted on GitHub +and downloads can be found from PyPI.

+

SeleniumLibrary works with Selenium 3 and 4. It supports Python 3.6 or +newer. In addition to the normal Python interpreter, it works also +with PyPy.

+

SeleniumLibrary is based on the old SeleniumLibrary that was forked to +Selenium2Library and then later renamed back to SeleniumLibrary. +See the Versions and History sections below for more information about +different versions and the overall project history.

+https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version +https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg +https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg +https://github.com/robotframework/SeleniumLibrary/workflows/SeleniumLibrary%20CI/badge.svg +
+
+

Keyword Documentation

+

See keyword documentation for available keywords and more information +about the library in general.

+
+
+

Installation

+

The recommended installation method is using pip:

+
pip install --upgrade robotframework-seleniumlibrary
+

Running this command installs also the latest Selenium and Robot Framework +versions, but you still need to install browser drivers separately. +The --upgrade option can be omitted when installing the library for the +first time.

+

Those migrating from Selenium2Library can install SeleniumLibrary so that +it is exposed also as Selenium2Library:

+
pip install --upgrade robotframework-selenium2library
+

The above command installs the normal SeleniumLibrary as well as a new +Selenium2Library version that is just a thin wrapper to SeleniumLibrary. +That allows importing Selenium2Library in tests while migrating to +SeleniumLibrary.

+

To install the last legacy Selenium2Library version, use this command instead:

+
pip install robotframework-selenium2library==1.8.0
+

With recent versions of pip it is possible to install directly from the +GitHub repository. To install latest source from the master branch, use +this command:

+
pip install git+https://github.com/robotframework/SeleniumLibrary.git
+

Please note that installation will take some time, because pip will +clone the SeleniumLibrary project to a temporary directory and then +perform the installation.

+

See Robot Framework installation instructions for detailed information +about installing Python and Robot Framework itself. For more details about +using pip see its own documentation.

+
+
+

Browser drivers

+

After installing the library, you still need to install browser and +operating system specific browser drivers for all those browsers you +want to use in tests. These are the exact same drivers you need to use with +Selenium also when not using SeleniumLibrary. More information about +drivers can be found from Selenium documentation.

+

The general approach to install a browser driver is downloading a right +driver, such as chromedriver for Chrome, and placing it into +a directory that is in PATH. Drivers for different browsers +can be found via Selenium documentation or by using your favorite +search engine with a search term like selenium chrome browser driver. +New browser driver versions are released to support features in +new browsers, fix bug, or otherwise, and you need to keep an eye on them +to know when to update drivers you use.

+

Alternatively, you can use a tool called WebdriverManager which can +find the latest version or when required, any version of appropriate +webdrivers for you and then download and link/copy it into right +location. Tool can run on all major operating systems and supports +downloading of Chrome, Firefox, Opera & Edge webdrivers.

+

Here's an example:

+
pip install webdrivermanager
+webdrivermanager firefox chrome --linkpath /usr/local/bin
+
+
+

Usage

+

To use SeleniumLibrary in Robot Framework tests, the library needs to +first be imported using the Library setting as any other library. +The library accepts some import time arguments, which are documented +in the keyword documentation along with all the keywords provided +by the library.

+

When using Robot Framework, it is generally recommended to write as +easy-to-understand tests as possible. The keywords provided by +SeleniumLibrary is pretty low level, though, and often require +implementation-specific arguments like element locators to be passed +as arguments. It is thus typically a good idea to write tests using +Robot Framework's higher-level keywords that utilize SeleniumLibrary +keywords internally. This is illustrated by the following example +where SeleniumLibrary keywords like Input Text are primarily +used by higher-level keywords like Input Username.

+
*** Settings ***
+Documentation     Simple example using SeleniumLibrary.
+Library           SeleniumLibrary
+
+*** Variables ***
+${LOGIN URL}      http://localhost:7272
+${BROWSER}        Chrome
+
+*** Test Cases ***
+Valid Login
+    Open Browser To Login Page
+    Input Username    demo
+    Input Password    mode
+    Submit Credentials
+    Welcome Page Should Be Open
+    [Teardown]    Close Browser
+
+*** Keywords ***
+Open Browser To Login Page
+    Open Browser    ${LOGIN URL}    ${BROWSER}
+    Title Should Be    Login Page
+
+Input Username
+    [Arguments]    ${username}
+    Input Text    username_field    ${username}
+
+Input Password
+    [Arguments]    ${password}
+    Input Text    password_field    ${password}
+
+Submit Credentials
+    Click Button    login_button
+
+Welcome Page Should Be Open
+    Title Should Be    Welcome Page
+

The above example is a slightly modified version of an example in a +demo project that illustrates using Robot Framework and SeleniumLibrary. +See the demo for more examples that you can also execute on your own +machine. For more information about Robot Framework test data syntax in +general see the Robot Framework User Guide.

+
+
+

Extending SeleniumLibrary

+

Before creating your own library which extends the SeleniumLibrary, please consider would +the extension be also useful also for general usage. If it could be useful also for general +usage, please create a new issue describing the enhancement request and even better if the +issue is backed up by a pull request.

+

If the enhancement is not generally useful, example solution is domain specific, then the +SeleniumLibrary offers public APIs which can be used to build its own plugins and libraries. +Plugin API allows us to add new keywords, modify existing keywords and modify the internal +functionality of the library. Also new libraries can be built on top of the +SeleniumLibrary. Please see extending documentation for more details about the +available methods and for examples how the library can be extended.

+
+
+

Community

+

If the provided documentation is not enough, there are various community channels +available:

+ +
+
+

Versions

+

SeleniumLibrary has over the years lived under SeleniumLibrary and +Selenium2Library names and different library versions have supported +different Selenium and Python versions. This is summarized in the table +below and the History section afterwards explains the project history +a bit more.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Project

Selenium Version

Python Version

Comment

SeleniumLibrary 2.9.2 and earlier

Selenium 1 and 2

Python 2.5-2.7

The original SeleniumLibrary using Selenium RC API.

Selenium2Library 1.8.0 and earlier

Selenium 2 and 3

Python 2.6-2.7

Fork of SeleniumLibrary using Selenium WebDriver API.

SeleniumLibrary 3.0 and 3.1

Selenium 2 and 3

Python 2.7 and 3.3+

Selenium2Library renamed and with Python 3 support and new architecture.

SeleniumLibrary 3.2

Selenium 3

Python 2.7 and 3.4+

Drops Selenium 2 support.

SeleniumLibrary 4.0

Selenium 3

Python 2.7 and 3.4+

Plugin API and support for event friging webdriver.

SeleniumLibrary 4.1

Selenium 3

Python 2.7 and 3.5+

Drops Python 3.4 support.

SeleniumLibrary 4.2

Selenium 3

Python 2.7 and 3.5+

Supports only Selenium 3.141.0 or newer.

SeleniumLibrary 4.4

Selenium 3 and 4

Python 2.7 and 3.6+

New PythonLibCore and dropped Python 3.5 support.

SeleniumLibrary 5.0

Selenium 3 and 4

Python 3.6+

Python 2 and Jython support is dropped.

SeleniumLibrary 5.1

Selenium 3 and 4

Python 3.6+

Robot Framework 3.1 support is dropped.

Selenium2Library 3.0

Depends on SeleniumLibrary

Depends on SeleniumLibrary

Thin wrapper for SeleniumLibrary 3.0 to ease transition.

+
+
+

History

+

SeleniumLibrary originally used the Selenium Remote Controller (RC) API. +When Selenium 2 was introduced with the new but backwards incompatible +WebDriver API, SeleniumLibrary kept using Selenium RC and separate +Selenium2Library using WebDriver was forked. These projects contained +mostly the same keywords and in most cases Selenium2Library was a drop-in +replacement for SeleniumLibrary.

+

Over the years development of the old SeleniumLibrary stopped and also +the Selenium RC API it used was deprecated. Selenium2Library was developed +further and replaced the old library as the de facto web testing library +for Robot Framework.

+

When Selenium 3 was released in 2016, it was otherwise backwards compatible +with Selenium 2, but the deprecated Selenium RC API was removed. This had two +important effects:

+
    +
  • The old SeleniumLibrary could not anymore be used with new Selenium versions. +This project was pretty much dead.

  • +
  • Selenium2Library was badly named as it supported Selenium 3 just fine. +This project needed a new name.

  • +
+

At the same time when Selenium 3 was released, Selenium2Library was going +through larger architecture changes in order to ease future maintenance and +to make adding Python 3 support easier. With all these big internal and +external changes, it made sense to rename Selenium2Library back to +SeleniumLibrary. This decision basically meant following changes:

+
    +
  • Create separate repository for the old SeleniumLibrary to preserve +its history since Selenium2Library was forked.

  • +
  • Rename Selenium2Library project and the library itself to SeleniumLibrary.

  • +
  • Add new Selenium2Library project to ease transitioning from Selenium2Library +to SeleniumLibrary.

  • +
+

Going forward, all new development will happen in the new SeleniumLibrary +project.

+
+
+ + From 680fbf905f05066ded84b61b2b96c82731b25022 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 29 Apr 2023 16:18:10 -0400 Subject: [PATCH 066/407] Updated the build instructions and some moinor format changes --- BUILD.rst | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/BUILD.rst b/BUILD.rst index ffc4b1a41..9033fdaa4 100644 --- a/BUILD.rst +++ b/BUILD.rst @@ -164,22 +164,25 @@ Generate Stub file Documentation ------------- -If generating release candidate or final release documentation, use `invoke kw-docs` -but if this alpha or beta release, use `invoke kw-docs $VERSION`. The `invoke kw-docs $VERSION` +If generating release candidate or final release documentation, use ``invoke kw-docs``` +but if this alpha or beta release, use ``invoke kw-docs $VERSION``. The ``invoke kw-docs $VERSION`` does not replace the previous final release documentation, instead it will create new file -with docs/SeleniumLibrary-$VERSION.html. From the below, execute either 1.1 or 1.2 step. The step +with docs/SeleniumLibrary-$VERSION.html. From the below, execute either 1.A or 1.B step. The step 2. is done always. -Note that this *must* be done after`setting version `_ above +Note that this *must* be done after `setting version `_ above or docs will have wrong version number. -1.1. Generate pre or final release keyword documentation:: +1. + A. Generate *pre or final release* keyword documentation:: invoke kw-docs git commit -m "Generated docs for version $VERSION" docs/SeleniumLibrary.html git push -1.2 Generate alpha or beta release keyword documentation:: + **OR** + + B. Generate *alpha or beta release* keyword documentation:: invoke kw-docs -v $VERSION git add docs/SeleniumLibrary-$VERSION.html @@ -192,7 +195,8 @@ push the new README.rst:: git commit -m "Add alpha/beta kw docs for version $VERSION in README.rst" README.rst git push -2. If README.rst has changed, generate project documentation based on it:: +2. If README.rst has changed, generate project documentation based on it. One can check with + the command ``git log ..HEAD --oneline README.rst``:: invoke project-docs git commit -m "Regenerated project docs" docs/index.html From faa45c3f6307c51c442fa3158ef7a17a0f5f41ee Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 29 Apr 2023 16:23:18 -0400 Subject: [PATCH 067/407] Release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 192 ++++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 docs/SeleniumLibrary-6.1.0rc2.rst diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst new file mode 100644 index 000000000..fc4db7fbe --- /dev/null +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -0,0 +1,192 @@ +======================== +SeleniumLibrary 6.1.0rc2 +======================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.1.0rc2 is a new release with +**UPDATE** enhancements and bug fixes. **ADD more intro stuff...** + +All issues targeted for SeleniumLibrary v6.1.0 can be found +from the `issue tracker`_. + +If you have pip_ installed, just run + +:: + + pip install --pre --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.1.0rc2 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.1.0rc2 was released on Saturday April 29, 2023. SeleniumLibrary supports +Python 3.7+, Selenium 4.0+ and Robot Framework 4.1.3 or higher. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.1.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +**EXPLAIN** or remove these. + +- Add API to set page load timeout (`#1535`_) (`#1754`_) +- Update webdrivertools.py (`#1698`_) +- Added clarifying information about timeouts (`#1740`_) +- Users can now modify ActionChains() duration. (`#1812`_) +- Remove deprecated opera support (`#1786`_) + +Deprecated features +=================== + +**EXPLAIN** or remove these. + +- Remove deprecated opera support (`#1786`_) +- fix `StringIO` import as it was removed in robot 5.0 (`#1753`_) +- Remove deprecated rebot option (`#1793`_) + +Acknowledgements +================ + +**EXPLAIN** or remove these. + +- Add API to set page load timeout (`#1535`_) (`#1754`_) +- Update webdrivertools.py (`#1698`_) +- Added clarifying information about timeouts (`#1740`_) +- Users can now modify ActionChains() duration. (`#1812`_) +- Remove deprecated opera support (`#1786`_) +- Microsoft edge webdriver (`#1795`_) +- RemoteDriverServerException was removed from Selenium (`#1804`_) +- Review workaround for slenium3 bug tests (`#1789`_) + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1754`_ + - enhancement + - critical + - Add API to set page load timeout (`#1535`_) + * - `#1698`_ + - enhancement + - high + - Update webdrivertools.py + * - `#1740`_ + - enhancement + - high + - Added clarifying information about timeouts + * - `#1812`_ + - enhancement + - high + - Users can now modify ActionChains() duration. + * - `#1786`_ + - --- + - high + - Remove deprecated opera support + * - `#1797`_ + - bug + - medium + - Fix windowns utest running + * - `#1798`_ + - bug + - medium + - Use python interpreter that executed atest/run.py instead of python + * - `#1795`_ + - enhancement + - medium + - Microsoft edge webdriver + * - `#1804`_ + - --- + - medium + - RemoteDriverServerException was removed from Selenium + * - `#1794`_ + - bug + - low + - Documentation timing + * - `#1806`_ + - enhancement + - low + - Remove remote driver server exception + * - `#1807`_ + - enhancement + - low + - Rf v5 v6 + * - `#1815`_ + - enhancement + - low + - Updated `Test Get Cookie Keyword Logging` with Samesite attribute + * - `#1753`_ + - --- + - low + - fix `StringIO` import as it was removed in robot 5.0 + * - `#1793`_ + - --- + - low + - Remove deprecated rebot option + * - `#1734`_ + - --- + - --- + - Update PLC to 3.0.0 + * - `#1785`_ + - --- + - --- + - Review Page Should Contain documentation + * - `#1788`_ + - --- + - --- + - Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 + * - `#1789`_ + - --- + - --- + - Review workaround for slenium3 bug tests + * - `#1808`_ + - --- + - --- + - Fix tests on firefox + +Altogether 20 issues. View on the `issue tracker `__. + +.. _#1754: https://github.com/robotframework/SeleniumLibrary/issues/1754 +.. _#1698: https://github.com/robotframework/SeleniumLibrary/issues/1698 +.. _#1740: https://github.com/robotframework/SeleniumLibrary/issues/1740 +.. _#1812: https://github.com/robotframework/SeleniumLibrary/issues/1812 +.. _#1786: https://github.com/robotframework/SeleniumLibrary/issues/1786 +.. _#1797: https://github.com/robotframework/SeleniumLibrary/issues/1797 +.. _#1798: https://github.com/robotframework/SeleniumLibrary/issues/1798 +.. _#1795: https://github.com/robotframework/SeleniumLibrary/issues/1795 +.. _#1804: https://github.com/robotframework/SeleniumLibrary/issues/1804 +.. _#1794: https://github.com/robotframework/SeleniumLibrary/issues/1794 +.. _#1806: https://github.com/robotframework/SeleniumLibrary/issues/1806 +.. _#1807: https://github.com/robotframework/SeleniumLibrary/issues/1807 +.. _#1815: https://github.com/robotframework/SeleniumLibrary/issues/1815 +.. _#1753: https://github.com/robotframework/SeleniumLibrary/issues/1753 +.. _#1793: https://github.com/robotframework/SeleniumLibrary/issues/1793 +.. _#1734: https://github.com/robotframework/SeleniumLibrary/issues/1734 +.. _#1785: https://github.com/robotframework/SeleniumLibrary/issues/1785 +.. _#1788: https://github.com/robotframework/SeleniumLibrary/issues/1788 +.. _#1789: https://github.com/robotframework/SeleniumLibrary/issues/1789 +.. _#1808: https://github.com/robotframework/SeleniumLibrary/issues/1808 From 749833f3bb154cc4b0e659941fe9e06ccedbbbb8 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 30 Apr 2023 19:43:44 -0400 Subject: [PATCH 068/407] Updated release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 99 ++++++++++++++++--------------- 1 file changed, 50 insertions(+), 49 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index fc4db7fbe..acf0d9ecb 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -48,10 +48,11 @@ Most important enhancements **EXPLAIN** or remove these. -- Add API to set page load timeout (`#1535`_) (`#1754`_) +- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) +- Add API to set page load timeout (`#1535`_) - Update webdrivertools.py (`#1698`_) -- Added clarifying information about timeouts (`#1740`_) -- Users can now modify ActionChains() duration. (`#1812`_) +- Suggestion for clarifying documentation around Timeouts (`#1738`_) +- Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. (`#1768`_) - Remove deprecated opera support (`#1786`_) Deprecated features @@ -68,14 +69,19 @@ Acknowledgements **EXPLAIN** or remove these. -- Add API to set page load timeout (`#1535`_) (`#1754`_) +- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) +- Add API to set page load timeout (`#1535`_) - Update webdrivertools.py (`#1698`_) -- Added clarifying information about timeouts (`#1740`_) -- Users can now modify ActionChains() duration. (`#1812`_) +- Suggestion for clarifying documentation around Timeouts (`#1738`_) +- Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. (`#1768`_) - Remove deprecated opera support (`#1786`_) +- Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 (`#1788`_) - Microsoft edge webdriver (`#1795`_) +- Fix tests on firefox (`#1808`_) - RemoteDriverServerException was removed from Selenium (`#1804`_) -- Review workaround for slenium3 bug tests (`#1789`_) +- Rf v5 v6 (`#1807`_) +- fix `StringIO` import as it was removed in robot 5.0 (`#1753`_) +- Remove deprecated rebot option (`#1793`_) Full list of fixes and enhancements =================================== @@ -87,38 +93,54 @@ Full list of fixes and enhancements - Type - Priority - Summary - * - `#1754`_ + * - `#1733`_ + - bug + - high + - The Wait Until * keywords don't support a None value for the error parameter + * - `#1535`_ - enhancement - - critical - - Add API to set page load timeout (`#1535`_) + - high + - Add API to set page load timeout * - `#1698`_ - enhancement - high - Update webdrivertools.py - * - `#1740`_ + * - `#1738`_ - enhancement - high - - Added clarifying information about timeouts - * - `#1812`_ + - Suggestion for clarifying documentation around Timeouts + * - `#1768`_ - enhancement - high - - Users can now modify ActionChains() duration. + - Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. * - `#1786`_ - --- - high - Remove deprecated opera support - * - `#1797`_ + * - `#1785`_ - bug - medium - - Fix windowns utest running - * - `#1798`_ + - Review Page Should Contain documentation + * - `#1796`_ - bug - medium - - Use python interpreter that executed atest/run.py instead of python + - atest task loses python interpreter when running with virtualenv under Windows + * - `#1788`_ + - enhancement + - medium + - Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 * - `#1795`_ - enhancement - medium - Microsoft edge webdriver + * - `#1808`_ + - enhancement + - medium + - Fix tests on firefox + * - `#1789`_ + - --- + - medium + - Review workaround for selenium3 bug tests * - `#1804`_ - --- - medium @@ -147,37 +169,21 @@ Full list of fixes and enhancements - --- - low - Remove deprecated rebot option - * - `#1734`_ - - --- - - --- - - Update PLC to 3.0.0 - * - `#1785`_ - - --- - - --- - - Review Page Should Contain documentation - * - `#1788`_ - - --- - - --- - - Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 - * - `#1789`_ - - --- - - --- - - Review workaround for slenium3 bug tests - * - `#1808`_ - - --- - - --- - - Fix tests on firefox -Altogether 20 issues. View on the `issue tracker `__. +Altogether 19 issues. View on the `issue tracker `__. -.. _#1754: https://github.com/robotframework/SeleniumLibrary/issues/1754 +.. _#1733: https://github.com/robotframework/SeleniumLibrary/issues/1733 +.. _#1535: https://github.com/robotframework/SeleniumLibrary/issues/1535 .. _#1698: https://github.com/robotframework/SeleniumLibrary/issues/1698 -.. _#1740: https://github.com/robotframework/SeleniumLibrary/issues/1740 -.. _#1812: https://github.com/robotframework/SeleniumLibrary/issues/1812 +.. _#1738: https://github.com/robotframework/SeleniumLibrary/issues/1738 +.. _#1768: https://github.com/robotframework/SeleniumLibrary/issues/1768 .. _#1786: https://github.com/robotframework/SeleniumLibrary/issues/1786 -.. _#1797: https://github.com/robotframework/SeleniumLibrary/issues/1797 -.. _#1798: https://github.com/robotframework/SeleniumLibrary/issues/1798 +.. _#1785: https://github.com/robotframework/SeleniumLibrary/issues/1785 +.. _#1796: https://github.com/robotframework/SeleniumLibrary/issues/1796 +.. _#1788: https://github.com/robotframework/SeleniumLibrary/issues/1788 .. _#1795: https://github.com/robotframework/SeleniumLibrary/issues/1795 +.. _#1808: https://github.com/robotframework/SeleniumLibrary/issues/1808 +.. _#1789: https://github.com/robotframework/SeleniumLibrary/issues/1789 .. _#1804: https://github.com/robotframework/SeleniumLibrary/issues/1804 .. _#1794: https://github.com/robotframework/SeleniumLibrary/issues/1794 .. _#1806: https://github.com/robotframework/SeleniumLibrary/issues/1806 @@ -185,8 +191,3 @@ Altogether 20 issues. View on the `issue tracker Date: Mon, 1 May 2023 08:48:43 -0400 Subject: [PATCH 069/407] Updated release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 69 ++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 24 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index acf0d9ecb..217e8a80a 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -8,7 +8,8 @@ SeleniumLibrary 6.1.0rc2 SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes the Selenium_ tool internally. SeleniumLibrary 6.1.0rc2 is a new release with -**UPDATE** enhancements and bug fixes. **ADD more intro stuff...** +some enhancements around timeouts, broadening edge support and removing +deprecated Opera support, and bug fixes. All issues targeted for SeleniumLibrary v6.1.0 can be found from the `issue tracker`_. @@ -47,42 +48,62 @@ Most important enhancements =========================== **EXPLAIN** or remove these. - -- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) +Set Page Load Timeout +--------------------- - Add API to set page load timeout (`#1535`_) -- Update webdrivertools.py (`#1698`_) -- Suggestion for clarifying documentation around Timeouts (`#1738`_) + +Action Chain ??????? +-------------------- - Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. (`#1768`_) -- Remove deprecated opera support (`#1786`_) + +Timeout documentation updated +----------------------------- +- Suggestion for clarifying documentation around Timeouts (`#1738`_) + +Edge webdriver under Linux +-------------------------- +- Update webdrivertools.py (`#1698`_) + +Bug fixes +========= +- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) Deprecated features =================== -**EXPLAIN** or remove these. +- Support for the Opera browser was removed from the underlying Selenium Python + bindings and thus we have removed the deprecated opera support. (`#1786`_) +- *Internal Only:* The library's acceptance tests removed a deprecated rebot + option. (`#1793`_) -- Remove deprecated opera support (`#1786`_) -- fix `StringIO` import as it was removed in robot 5.0 (`#1753`_) -- Remove deprecated rebot option (`#1793`_) +**NOTE DEPRECIATING SELENIUM2LIBRARY** Acknowledgements ================ -**EXPLAIN** or remove these. - -- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) -- Add API to set page load timeout (`#1535`_) -- Update webdrivertools.py (`#1698`_) -- Suggestion for clarifying documentation around Timeouts (`#1738`_) -- Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. (`#1768`_) -- Remove deprecated opera support (`#1786`_) -- Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 (`#1788`_) -- Microsoft edge webdriver (`#1795`_) -- Fix tests on firefox (`#1808`_) -- RemoteDriverServerException was removed from Selenium (`#1804`_) -- Rf v5 v6 (`#1807`_) -- fix `StringIO` import as it was removed in robot 5.0 (`#1753`_) +- `@0xLeon `_ for suggesting and `@robinmatz `_ enhancing the page + load timout adding an API to set page load timeout (`#1535`_) +- `@ johnpp143`_ for reporting the action chains timeout + was fixed and unchangble. `@ rasjani`_ for enhancing + the libraruy import and adding keywords allowing for user to set the Action Chain's + duration. (`#1768`_) +- `Dave Martin `_ for enhancing the documentation + around Timeouts. (`#1738`_) +- `@tminakov `_ for pointing out the issue around the + None type and `Tato Aalto `_ and `Pekka Klärck `_ + for enhancing the core and PLC resolving an issue with types. (`#1733`_) +- `@remontees `_ for adding support for Edge webdriver under Linux. (`#1698`_) +- `Lassi Heikkinen `_ for assisting in removing deprecated + opera support (`#1786`_), for enhancing the acceptance tests (`#1788`_), and for + fixing the tests on firefox (`#1808`_). +- `@dotlambda `_ for pointing out that the + RemoteDriverServerException was removed from Selenium (`#1804`_) +- `@DetachHead `_ for fixing `StringIO` import as it was + removed in robot 5.0 (`#1753`_) - Remove deprecated rebot option (`#1793`_) +**ACKNOWLEDGE TEAM MEMBERS** + Full list of fixes and enhancements =================================== From fbf9c9754abcb71b6191c5a3a87bb8d5ffd20b0e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 1 May 2023 09:57:23 -0400 Subject: [PATCH 070/407] Updated release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 61 ++++++++++++++++++++++++------- 1 file changed, 47 insertions(+), 14 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index 217e8a80a..d68db9b01 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -47,26 +47,57 @@ Python 3.7+, Selenium 4.0+ and Robot Framework 4.1.3 or higher. Most important enhancements =========================== -**EXPLAIN** or remove these. Set Page Load Timeout --------------------- -- Add API to set page load timeout (`#1535`_) +The ability to set the page load timeout value was added (`#1535`_). This can be done on the Library import. +For example, one could set it to ten seconds, as in .. -Action Chain ??????? --------------------- -- Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. (`#1768`_) +.. sourcecode:: robotframework + + *** Setting *** + Library SeleniumLibrary page_load_timeout=10 seconds + +In addition there are two addition keywords (``Set Selenium Page Load Timeout`` and ``Get Selenium Page Load Timeout``) +which allow for changing the page load timeout within a script. See the keyword documentation for more information. + +Duration of mouse movements within Action Chains +------------------------------------------------ +Actions chains allow for building up a series of interactions including mouse movements. As to simulate an acutal +user moving the mouse a default duration (250ms) for pointer movements is set. This change (`#1768`_) allows for +the action chain duration to be modified. This can be done on the Library import, as in, + +.. sourcecode:: robotframework + + *** Setting *** + Library SeleniumLibrary action_chain_delay=100 milliseconds + +or with the setter keyword ``Set Action Chain Delay``. In addition one can get the current duretion with the +new keyword ``Get Action Chain Delay``. See the keyword documentation for more information. Timeout documentation updated ----------------------------- -- Suggestion for clarifying documentation around Timeouts (`#1738`_) +The keyword documentation around timeouts was enhanced (`#1738`_) to clarrify what the default timeout is +and that the default is used is ``None`` is specified. The changes are, as shown in **bold**, + + The default timeout these keywords use can be set globally either by using the Set Selenium Timeout + keyword or with the timeout argument when importing the library. **If no default timeout is set + globally, the default is 5 seconds. If None is specified for the timeout argument in the keywords, + the default is used.** See time format below for supported timeout syntax. Edge webdriver under Linux -------------------------- -- Update webdrivertools.py (`#1698`_) +The executable path to the edge browser has been changed (`#1698`_) so as to support both Windows and +Linux/Unix/MacOSes. One should not notice any difference under Windows but under Linux/*nix one will +no longer get an error message saying the Windows executable is missing. Bug fixes ========= -- The Wait Until * keywords don't support a None value for the error parameter (`#1733`_) + +``None`` argument not correctly converted +----------------------------------------- +There were some issues when using ``None`` as a parameter under certain arguments within the +SeleniumLibrary(`#1733`_). This was due to the type hinting and argument conversions. The underlying +issue was resolved within the PythonLibCore to which we have upgraded to PythonLibCore v3.0.0. Deprecated features =================== @@ -81,11 +112,12 @@ Deprecated features Acknowledgements ================ -- `@0xLeon `_ for suggesting and `@robinmatz `_ enhancing the page +- `@0xLeon `_ for suggesting and + `@robinmatz `_ enhancing the page load timout adding an API to set page load timeout (`#1535`_) -- `@ johnpp143`_ for reporting the action chains timeout +- `@johnpp143 `_ for reporting the action chains timeout was fixed and unchangble. `@ rasjani`_ for enhancing - the libraruy import and adding keywords allowing for user to set the Action Chain's + the library import and adding keywords allowing for user to set the Action Chain's duration. (`#1768`_) - `Dave Martin `_ for enhancing the documentation around Timeouts. (`#1738`_) @@ -94,16 +126,17 @@ Acknowledgements for enhancing the core and PLC resolving an issue with types. (`#1733`_) - `@remontees `_ for adding support for Edge webdriver under Linux. (`#1698`_) - `Lassi Heikkinen `_ for assisting in removing deprecated - opera support (`#1786`_), for enhancing the acceptance tests (`#1788`_), and for - fixing the tests on firefox (`#1808`_). + opera support (`#1786`_), for enhancing the acceptance tests (`#1788`_), for + fixing the tests on firefox (`#1808`_), and for removing the deprecated rebot option (`#1793`_). - `@dotlambda `_ for pointing out that the RemoteDriverServerException was removed from Selenium (`#1804`_) - `@DetachHead `_ for fixing `StringIO` import as it was removed in robot 5.0 (`#1753`_) -- Remove deprecated rebot option (`#1793`_) + **ACKNOWLEDGE TEAM MEMBERS** + Full list of fixes and enhancements =================================== From 5e3a8306c0bba132842b4c3f9c2165faa41b4cd9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 1 May 2023 10:32:27 -0400 Subject: [PATCH 071/407] Updated release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index d68db9b01..688399c54 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -50,7 +50,7 @@ Most important enhancements Set Page Load Timeout --------------------- The ability to set the page load timeout value was added (`#1535`_). This can be done on the Library import. -For example, one could set it to ten seconds, as in .. +For example, one could set it to ten seconds, as in, .. sourcecode:: robotframework @@ -76,8 +76,8 @@ new keyword ``Get Action Chain Delay``. See the keyword documentation for more i Timeout documentation updated ----------------------------- -The keyword documentation around timeouts was enhanced (`#1738`_) to clarrify what the default timeout is -and that the default is used is ``None`` is specified. The changes are, as shown in **bold**, +The keyword documentation around timeouts was enhanced (`#1738`_) to clarify what the default timeout is +and that the default is used if ``None`` is specified. The changes are, as shown in **bold**, The default timeout these keywords use can be set globally either by using the Set Selenium Timeout keyword or with the timeout argument when importing the library. **If no default timeout is set @@ -87,7 +87,7 @@ and that the default is used is ``None`` is specified. The changes are, as shown Edge webdriver under Linux -------------------------- The executable path to the edge browser has been changed (`#1698`_) so as to support both Windows and -Linux/Unix/MacOSes. One should not notice any difference under Windows but under Linux/*nix one will +Linux/Unix/MacOS OSes. One should not notice any difference under Windows but under Linux/*nix one will no longer get an error message saying the Windows executable is missing. Bug fixes @@ -107,16 +107,28 @@ Deprecated features - *Internal Only:* The library's acceptance tests removed a deprecated rebot option. (`#1793`_) -**NOTE DEPRECIATING SELENIUM2LIBRARY** +Upcoming Depreciation of Selenium2Library +========================================= + +*Please Take Note* - The SeleniumLibrary Team will be depreciating and removing the Selenium2Library +package in an upcoming release. When the underlying Selenium project transitioned, over six years ago, +from distinguishing between the "old" selenium (Selenium 1) and the "new" WebDriver Selenium 2 into +a numerically increasing versioning, this project decided to use the original SeleniumLibrary package +name. As a convenience the Selenium2Library packge was made a wrapper around the SeleniumLibrary +package. Due to the issues around upgrading packages and the simple passage of time, it is time to +depreciate and remove the Selenium2Library package. + +*If you are still installing the Selenium2Libary package please transition over, as soon as possible, +to installing the SeleniumLibrary package instead.* Acknowledgements ================ -- `@0xLeon `_ for suggesting and - `@robinmatz `_ enhancing the page - load timout adding an API to set page load timeout (`#1535`_) -- `@johnpp143 `_ for reporting the action chains timeout - was fixed and unchangble. `@ rasjani`_ for enhancing +- `@0xLeon `_ for suggesting and + `@robinmatz `_ enhancing the page + load timout adding an API to set page load timeout (`#1535`_) +- `@johnpp143 `_ for reporting the action chains timeout + was fixed and unchangble. `@rasjani `_ for enhancing the library import and adding keywords allowing for user to set the Action Chain's duration. (`#1768`_) - `Dave Martin `_ for enhancing the documentation From 8ee22c01928b5a497fe34c3d2de387fcf5bc9686 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 1 May 2023 11:10:14 -0400 Subject: [PATCH 072/407] Updated release notes for 6.1.0rc2 --- docs/SeleniumLibrary-6.1.0rc2.rst | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index 688399c54..c0a11f30f 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -110,7 +110,7 @@ Deprecated features Upcoming Depreciation of Selenium2Library ========================================= -*Please Take Note* - The SeleniumLibrary Team will be depreciating and removing the Selenium2Library +**Please Take Note** - The SeleniumLibrary Team will be depreciating and removing the Selenium2Library package in an upcoming release. When the underlying Selenium project transitioned, over six years ago, from distinguishing between the "old" selenium (Selenium 1) and the "new" WebDriver Selenium 2 into a numerically increasing versioning, this project decided to use the original SeleniumLibrary package @@ -128,9 +128,9 @@ Acknowledgements `@robinmatz `_ enhancing the page load timout adding an API to set page load timeout (`#1535`_) - `@johnpp143 `_ for reporting the action chains timeout - was fixed and unchangble. `@rasjani `_ for enhancing - the library import and adding keywords allowing for user to set the Action Chain's - duration. (`#1768`_) + as fixed and unchangable. `@rasjani `_ for enhancing + the library import and adding keywords allowing for user to set the Action Chain's + duration. (`#1768`_) - `Dave Martin `_ for enhancing the documentation around Timeouts. (`#1738`_) - `@tminakov `_ for pointing out the issue around the @@ -145,9 +145,18 @@ Acknowledgements - `@DetachHead `_ for fixing `StringIO` import as it was removed in robot 5.0 (`#1753`_) +In addition to the acknowledgements above I want to personally thank **Jani Mikkonen** as a co-maintainer of +the SeleniumLibrary and all the support he has given over the years. I also want to thank **Tatu Aalto** for +his continued support and guidance of and advice concerning the SeleniumLibrary. Despite "leaving" the +project, he still is actively helping me to which I again say Kiitos! As I talked about in our Keynote +talk at RoboCon 2023 I have been working on building up the SeleniumLibrary team. I want to acknowledge +the following people who have stepped up and have been starting to take a larger development and +leadership role with the SeleniumLibrary, -**ACKNOWLEDGE TEAM MEMBERS** +**Lassi Heikkinen, Lisa Crispin, Yuri Verweij, and Robin Matz** +Their active participation has made this library significantly better and I appreciate their contributions +and participation. -- `Ed Manlove `_ Full list of fixes and enhancements =================================== From 42e6fcb5d42e5169a16ded06ca81e0860bd9629b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 3 May 2023 08:26:53 -0400 Subject: [PATCH 073/407] Minor corrections to the release notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These will be moved over to the v6.1.0 release. No second release candidate be made as it was not necessary. I did want to work out the release notes prior to making the v.6.1.0 release and so they had gone into this v6.1.0rc2 README as a temporary placeholder. Thanks to Hélio Guilherme for reviewing and suggesting corrections to the release notes. --- docs/SeleniumLibrary-6.1.0rc2.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/SeleniumLibrary-6.1.0rc2.rst b/docs/SeleniumLibrary-6.1.0rc2.rst index c0a11f30f..9157333a9 100644 --- a/docs/SeleniumLibrary-6.1.0rc2.rst +++ b/docs/SeleniumLibrary-6.1.0rc2.rst @@ -114,7 +114,7 @@ Upcoming Depreciation of Selenium2Library package in an upcoming release. When the underlying Selenium project transitioned, over six years ago, from distinguishing between the "old" selenium (Selenium 1) and the "new" WebDriver Selenium 2 into a numerically increasing versioning, this project decided to use the original SeleniumLibrary package -name. As a convenience the Selenium2Library packge was made a wrapper around the SeleniumLibrary +name. As a convenience the Selenium2Library package was made a wrapper around the SeleniumLibrary package. Due to the issues around upgrading packages and the simple passage of time, it is time to depreciate and remove the Selenium2Library package. @@ -125,10 +125,10 @@ Acknowledgements ================ - `@0xLeon `_ for suggesting and - `@robinmatz `_ enhancing the page - load timout adding an API to set page load timeout (`#1535`_) + `@robinmatz `_ for enhancing the page + load timeout; adding an API to set page load timeout. (`#1535`_) - `@johnpp143 `_ for reporting the action chains timeout - as fixed and unchangable. `@rasjani `_ for enhancing + as fixed and unchangeable. `@rasjani `_ for enhancing the library import and adding keywords allowing for user to set the Action Chain's duration. (`#1768`_) - `Dave Martin `_ for enhancing the documentation From 6e8add13a8cb254255e5177aee2c15654693dc95 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 3 May 2023 08:49:53 -0400 Subject: [PATCH 074/407] Release notes for 6.1.0 --- docs/SeleniumLibrary-6.1.0.rst | 265 +++++++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 docs/SeleniumLibrary-6.1.0.rst diff --git a/docs/SeleniumLibrary-6.1.0.rst b/docs/SeleniumLibrary-6.1.0.rst new file mode 100644 index 000000000..e25452c9c --- /dev/null +++ b/docs/SeleniumLibrary-6.1.0.rst @@ -0,0 +1,265 @@ +===================== +SeleniumLibrary 6.1.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.1.0 is a new release with +some enhancements around timeouts, broadening edge support and removing +deprecated Opera support, and bug fixes. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.1.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.1.0 was released on Wednesday May 3, 2023. SeleniumLibrary supports +Python 3.7+, Selenium 4.0+ and Robot Framework 4.1.3 or higher. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.1.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +Set Page Load Timeout +--------------------- +The ability to set the page load timeout value was added (`#1535`_). This can be done on the Library import. +For example, one could set it to ten seconds, as in, + +.. sourcecode:: robotframework + + *** Setting *** + Library SeleniumLibrary page_load_timeout=10 seconds + +In addition there are two addition keywords (``Set Selenium Page Load Timeout`` and ``Get Selenium Page Load Timeout``) +which allow for changing the page load timeout within a script. See the keyword documentation for more information. + +Duration of mouse movements within Action Chains +------------------------------------------------ +Actions chains allow for building up a series of interactions including mouse movements. As to simulate an acutal +user moving the mouse a default duration (250ms) for pointer movements is set. This change (`#1768`_) allows for +the action chain duration to be modified. This can be done on the Library import, as in, + +.. sourcecode:: robotframework + + *** Setting *** + Library SeleniumLibrary action_chain_delay=100 milliseconds + +or with the setter keyword ``Set Action Chain Delay``. In addition one can get the current duretion with the +new keyword ``Get Action Chain Delay``. See the keyword documentation for more information. + +Timeout documentation updated +----------------------------- +The keyword documentation around timeouts was enhanced (`#1738`_) to clarify what the default timeout is +and that the default is used if ``None`` is specified. The changes are, as shown in **bold**, + + The default timeout these keywords use can be set globally either by using the Set Selenium Timeout + keyword or with the timeout argument when importing the library. **If no default timeout is set + globally, the default is 5 seconds. If None is specified for the timeout argument in the keywords, + the default is used.** See time format below for supported timeout syntax. + +Edge webdriver under Linux +-------------------------- +The executable path to the edge browser has been changed (`#1698`_) so as to support both Windows and +Linux/Unix/MacOS OSes. One should not notice any difference under Windows but under Linux/*nix one will +no longer get an error message saying the Windows executable is missing. + +Bug fixes +========= + +``None`` argument not correctly converted +----------------------------------------- +There were some issues when using ``None`` as a parameter under certain arguments within the +SeleniumLibrary(`#1733`_). This was due to the type hinting and argument conversions. The underlying +issue was resolved within the PythonLibCore to which we have upgraded to PythonLibCore v3.0.0. + +Deprecated features +=================== + +- Support for the Opera browser was removed from the underlying Selenium Python + bindings and thus we have removed the deprecated opera support. (`#1786`_) +- *Internal Only:* The library's acceptance tests removed a deprecated rebot + option. (`#1793`_) + +Upcoming Depreciation of Selenium2Library +========================================= + +**Please Take Note** - The SeleniumLibrary Team will be depreciating and removing the Selenium2Library +package in an upcoming release. When the underlying Selenium project transitioned, over six years ago, +from distinguishing between the "old" selenium (Selenium 1) and the "new" WebDriver Selenium 2 into +a numerically increasing versioning, this project decided to use the original SeleniumLibrary package +name. As a convenience the Selenium2Library package was made a wrapper around the SeleniumLibrary +package. Due to the issues around upgrading packages and the simple passage of time, it is time to +depreciate and remove the Selenium2Library package. + +*If you are still installing the Selenium2Libary package please transition over, as soon as possible, +to installing the SeleniumLibrary package instead.* + +Acknowledgements +================ + +- `@0xLeon `_ for suggesting and + `@robinmatz `_ for enhancing the page + load timeout; adding an API to set page load timeout. (`#1535`_) +- `@johnpp143 `_ for reporting the action chains timeout + as fixed and unchangeable. `@rasjani `_ for enhancing + the library import and adding keywords allowing for user to set the Action Chain's + duration. (`#1768`_) +- `Dave Martin `_ for enhancing the documentation + around Timeouts. (`#1738`_) +- `@tminakov `_ for pointing out the issue around the + None type and `Tato Aalto `_ and `Pekka Klärck `_ + for enhancing the core and PLC resolving an issue with types. (`#1733`_) +- `@remontees `_ for adding support for Edge webdriver under Linux. (`#1698`_) +- `Lassi Heikkinen `_ for assisting in removing deprecated + opera support (`#1786`_), for enhancing the acceptance tests (`#1788`_), for + fixing the tests on firefox (`#1808`_), and for removing the deprecated rebot option (`#1793`_). +- `@dotlambda `_ for pointing out that the + RemoteDriverServerException was removed from Selenium (`#1804`_) +- `@DetachHead `_ for fixing `StringIO` import as it was + removed in robot 5.0 (`#1753`_) + +In addition to the acknowledgements above I want to personally thank **Jani Mikkonen** as a co-maintainer of +the SeleniumLibrary and all the support he has given over the years. I also want to thank **Tatu Aalto** for +his continued support and guidance of and advice concerning the SeleniumLibrary. Despite "leaving" the +project, he still is actively helping me to which I again say Kiitos! As I talked about in our Keynote +talk at RoboCon 2023 I have been working on building up the SeleniumLibrary team. I want to acknowledge +the following people who have stepped up and have been starting to take a larger development and +leadership role with the SeleniumLibrary, + +**Lassi Heikkinen, Lisa Crispin, Yuri Verweij, and Robin Matz** + +Their active participation has made this library significantly better and I appreciate their contributions +and participation. -- `Ed Manlove `_ + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1733`_ + - bug + - high + - The Wait Until * keywords don't support a None value for the error parameter + * - `#1535`_ + - enhancement + - high + - Add API to set page load timeout + * - `#1698`_ + - enhancement + - high + - Update webdrivertools.py + * - `#1738`_ + - enhancement + - high + - Suggestion for clarifying documentation around Timeouts + * - `#1768`_ + - enhancement + - high + - Keywords which uses action chains are having a default 250ms timeout which cannot be overriden. + * - `#1786`_ + - --- + - high + - Remove deprecated opera support + * - `#1785`_ + - bug + - medium + - Review Page Should Contain documentation + * - `#1796`_ + - bug + - medium + - atest task loses python interpreter when running with virtualenv under Windows + * - `#1788`_ + - enhancement + - medium + - Acceptance tests: rebot option `--noncritical` is deprecated since RF 4 + * - `#1795`_ + - enhancement + - medium + - Microsoft edge webdriver + * - `#1808`_ + - enhancement + - medium + - Fix tests on firefox + * - `#1789`_ + - --- + - medium + - Review workaround for selenium3 bug tests + * - `#1804`_ + - --- + - medium + - RemoteDriverServerException was removed from Selenium + * - `#1794`_ + - bug + - low + - Documentation timing + * - `#1806`_ + - enhancement + - low + - Remove remote driver server exception + * - `#1807`_ + - enhancement + - low + - Rf v5 v6 + * - `#1815`_ + - enhancement + - low + - Updated `Test Get Cookie Keyword Logging` with Samesite attribute + * - `#1753`_ + - --- + - low + - fix `StringIO` import as it was removed in robot 5.0 + * - `#1793`_ + - --- + - low + - Remove deprecated rebot option + +Altogether 19 issues. View on the `issue tracker `__. + +.. _#1733: https://github.com/robotframework/SeleniumLibrary/issues/1733 +.. _#1535: https://github.com/robotframework/SeleniumLibrary/issues/1535 +.. _#1698: https://github.com/robotframework/SeleniumLibrary/issues/1698 +.. _#1738: https://github.com/robotframework/SeleniumLibrary/issues/1738 +.. _#1768: https://github.com/robotframework/SeleniumLibrary/issues/1768 +.. _#1786: https://github.com/robotframework/SeleniumLibrary/issues/1786 +.. _#1785: https://github.com/robotframework/SeleniumLibrary/issues/1785 +.. _#1796: https://github.com/robotframework/SeleniumLibrary/issues/1796 +.. _#1788: https://github.com/robotframework/SeleniumLibrary/issues/1788 +.. _#1795: https://github.com/robotframework/SeleniumLibrary/issues/1795 +.. _#1808: https://github.com/robotframework/SeleniumLibrary/issues/1808 +.. _#1789: https://github.com/robotframework/SeleniumLibrary/issues/1789 +.. _#1804: https://github.com/robotframework/SeleniumLibrary/issues/1804 +.. _#1794: https://github.com/robotframework/SeleniumLibrary/issues/1794 +.. _#1806: https://github.com/robotframework/SeleniumLibrary/issues/1806 +.. _#1807: https://github.com/robotframework/SeleniumLibrary/issues/1807 +.. _#1815: https://github.com/robotframework/SeleniumLibrary/issues/1815 +.. _#1753: https://github.com/robotframework/SeleniumLibrary/issues/1753 +.. _#1793: https://github.com/robotframework/SeleniumLibrary/issues/1793 From 29b4cdc49ff6e997b61681c56b512f4eae450cb4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 3 May 2023 08:51:09 -0400 Subject: [PATCH 075/407] Updated version to 6.1.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index a00b40b8e..d1e54c280 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -51,7 +51,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.1.0rc1" +__version__ = "6.1.0" class SeleniumLibrary(DynamicCore): From fa1c71cddb9728a9c24f82fd101aab4dea9a9481 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 3 May 2023 08:55:05 -0400 Subject: [PATCH 076/407] Generated docs for version 6.1.0 --- docs/SeleniumLibrary.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 6ff4f5d40..8f8018c54 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1193,7 +1193,7 @@ jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a - - - - - - - - -
-

Opening library documentation failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + From 9f2f7da93056848ebbf5818b8fdc414df14203ff Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 9 Sep 2023 17:05:45 -0400 Subject: [PATCH 119/407] Release notes for 6.1.2 --- docs/SeleniumLibrary-6.1.2.rst | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 docs/SeleniumLibrary-6.1.2.rst diff --git a/docs/SeleniumLibrary-6.1.2.rst b/docs/SeleniumLibrary-6.1.2.rst new file mode 100644 index 000000000..454b70fad --- /dev/null +++ b/docs/SeleniumLibrary-6.1.2.rst @@ -0,0 +1,77 @@ +===================== +SeleniumLibrary 6.1.2 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.1.2 is a hotfix release +focused on bug fixes for setting configuration options when using a remote Edge +or Safari Browser. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.1.2 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.1.2 was released on Saturday September 9, 2023. SeleniumLibrary supports +Python 3.7+, Selenium 4.3+ and Robot Framework 4.1.3 or higher. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.1.2 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Missing "Options" setup in EDGE browser for remote url execution (`#1844`_, rc 1) + + The browser options if given within the ``Open Browser`` or `Create WebDriver`` keyword were not being + passed to either a remote Edge or remote Safari browser. This has been fixed within this release. + +Acknowledgements +================ + +- I want to thank @ap0087105 for pointing out the library was missing "Options" setup within Edge and + Safari remote url execution (`#1844`_, rc 1) + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + - Added + * - `#1844`_ + - bug + - high + - Missing "Options" setup in EDGE browser for remote url execution + - rc 1 + +Altogether 1 issue. View on the `issue tracker `__. + +.. _#1844: https://github.com/robotframework/SeleniumLibrary/issues/1844 From 19b3dcc2cda46d7c8ee7aae071ccc44ed32ca01b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 9 Sep 2023 17:10:31 -0400 Subject: [PATCH 120/407] Updated version to 6.1.2 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 5a0c7816e..e3d80d9b4 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -51,7 +51,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.1.2rc1" +__version__ = "6.1.2" class SeleniumLibrary(DynamicCore): From f3caca2bcd68adda232e7f6b878f0bd08aa2d0aa Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 9 Sep 2023 17:11:51 -0400 Subject: [PATCH 121/407] Generated docs for version 6.1.2 --- docs/SeleniumLibrary.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index f8f51dd67..921a0e999 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1191,7 +1191,7 @@ jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a - - - - - - - - -
-

Opening library documentation failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From f4d9d377956100e6dae28d75a5b0cc53facdf802 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 12 Oct 2023 13:53:33 -0400 Subject: [PATCH 130/407] Modified/improved logic to check against default argument --- src/SeleniumLibrary/keywords/browsermanagement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index a1d3474ff..b648432cb 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -371,7 +371,7 @@ def create_webdriver( `Close All Browsers` keyword is used. See `Switch Browser` for an example. """ - if not kwargs: + if kwargs is None: kwargs = {} if not isinstance(kwargs, dict): raise RuntimeError("kwargs must be a dictionary.") From 87693af4f355a85a77aad4596c7a40b611449b33 Mon Sep 17 00:00:00 2001 From: Kieran Trautwein Date: Thu, 12 Oct 2023 04:40:41 +1030 Subject: [PATCH 131/407] Remove deprecated headless option for chrome and firefox. Deprecated in Version 4.8.0 of Selenium Removed in version 4.13.0 --- .../keywords/webdrivertools/webdrivertools.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 09ff06a87..ba191b7d1 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -161,7 +161,7 @@ def create_headless_chrome( ): if not options: options = webdriver.ChromeOptions() - options.headless = True + options.add_argument('--headless=new') return self.create_chrome( desired_capabilities, remote_url, options, service_log_path, executable_path ) @@ -224,7 +224,7 @@ def _get_ff_profile(self, ff_profile_dir): else: setattr(ff_profile, key, *option[key]) return ff_profile - + @property def _geckodriver_log(self): log_file = self._get_log_path( @@ -244,7 +244,7 @@ def create_headless_firefox( ): if not options: options = webdriver.FirefoxOptions() - options.headless = True + options.add_argument('-headless') return self.create_firefox( desired_capabilities, remote_url, From c9147e7522c9357b8d4cb0ab82ee4251f2f17e82 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 13:19:07 -0400 Subject: [PATCH 132/407] Setup Chrome and chromedriver via selenium-manager We want to setup Chrome before we execute the tasks so that we can avoid selenium-manager doing at the time of execution and changing the debug log messages. --- .github/workflows/CI.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0ee38f2cd..ec03cf723 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,6 +17,18 @@ jobs: uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + - name: Setup Chrome + uses: browser-actions/setup-chrome@latest + with: + chrome-version: latest + id: setup-chrome + - run: | + echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} + ${{ steps.setup-chrome.outputs.chrome-path }} --version + - run: | + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') + echo "$SELENIUM_MANAGER_EXE" + $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Start xvfb run: | export DISPLAY=:99.0 From 98d9aa8ad9fae5fb65c4bc770e95e777e04f23c3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 13:26:55 -0400 Subject: [PATCH 133/407] Moved selenium-manager execution till after installing selenium --- .github/workflows/CI.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ec03cf723..5d98ec8a7 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,10 +25,6 @@ jobs: - run: | echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} ${{ steps.setup-chrome.outputs.chrome-path }} --version - - run: | - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') - echo "$SELENIUM_MANAGER_EXE" - $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Start xvfb run: | export DISPLAY=:99.0 @@ -48,6 +44,11 @@ jobs: - name: Install RF ${{ matrix.rf-version }} run: | pip install -U --pre robotframework==${{ matrix.rf-version }} + - name: Install drivers via selenium-manager + run: | + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') + echo "$SELENIUM_MANAGER_EXE" + $SELENIUM_MANAGER_EXE --browser chrome --debug - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | From b5bd87b3115ffa65ea6a76bbf03838de8fd663bc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 19:49:06 -0400 Subject: [PATCH 134/407] Attempting to get selenium-manager not to run during script To avoid having the extra logging for selenium-manager (or at least to control the debug output) we are setting the executable_path or the path to the driver. Trying with the event_firing_webdriver script to see if we see debug output there. --- .github/workflows/CI.yml | 2 +- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5d98ec8a7..b29b2853d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - $SELENIUM_MANAGER_EXE --browser chrome --debug + DRIVER_PATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 1392f2bbf..bd6ce1550 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} desired_capabilities=${DESIRED_CAPABILITIES} +... remote_url=${REMOTE_URL} executable_path=%{DRIVER_PATH} Suite Teardown Close All Browsers *** Variables *** From 4a57052be1b1182d622273e1b2bab6b8b7b90df7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:02:30 -0400 Subject: [PATCH 135/407] Robot might hase trouble with environment variables with an underscore --- .github/workflows/CI.yml | 3 ++- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b29b2853d..020b7842f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,8 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - DRIVER_PATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' run: | diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index bd6ce1550..a43009cfc 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=%{DRIVER_PATH} +... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} Suite Teardown Close All Browsers *** Variables *** From dc3f00151a13d8f8b9b45c6009f64e4d15c113f2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:14:52 -0400 Subject: [PATCH 136/407] Try source the env variable --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 020b7842f..9a8b386d1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + source WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' From e254fd3865ca40e39fc954684b414508317b0cc1 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:22:08 -0400 Subject: [PATCH 137/407] Trying export instead of source --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9a8b386d1..9b86478b5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - source WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + export WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' From 82f7fed0c3683c26214cc8ef31ab8f1f57431417 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 20:35:25 -0400 Subject: [PATCH 138/407] Try hard coding driver executable path --- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index a43009cfc..863b5e284 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} +... remote_url=${REMOTE_URL} executable_path=/usr/bin/chromedriver Suite Teardown Close All Browsers *** Variables *** From 62e0d2be801f31bbfb90f22fd8144798d7cf750a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 21:10:23 -0400 Subject: [PATCH 139/407] Corrected setting env variable within Github Actions There is apparently a method for setting variables. Basically, echo "{environment_variable_name}={value}" >> "$GITHUB_ENV" Trying this out .. Reference: https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable --- .github/workflows/CI.yml | 2 +- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9b86478b5..5d59b5c10 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,7 +48,7 @@ jobs: run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" - export WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}') + echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} if: matrix.python-version != 'pypy-3.7' diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index 863b5e284..a43009cfc 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -2,7 +2,7 @@ Library SeleniumLibrary event_firing_webdriver=${CURDIR}/../../resources/testlibs/MyListener.py Resource resource_event_firing_webdriver.robot Suite Setup Open Browser ${FRONT PAGE} ${BROWSER} alias=event_firing_webdriver -... remote_url=${REMOTE_URL} executable_path=/usr/bin/chromedriver +... remote_url=${REMOTE_URL} executable_path=%{WEBDRIVERPATH} Suite Teardown Close All Browsers *** Variables *** From 5b5c598e3ba5c4650231911221622494dbc2a820 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:19:32 -0400 Subject: [PATCH 140/407] Update atests some with preconfigured webdriver --- .../2-event_firing_webdriver/event_firing_webdriver.robot | 2 +- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/keywords/page_load_timeout.robot | 6 ++++-- atest/acceptance/multiple_browsers_options.robot | 6 ++++++ atest/acceptance/open_and_close.robot | 2 +- .../{remote_browsers.robot => remote_browsers.robot.TRIAGE} | 0 6 files changed, 13 insertions(+), 5 deletions(-) rename atest/acceptance/{remote_browsers.robot => remote_browsers.robot.TRIAGE} (100%) diff --git a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot index a43009cfc..ea9d633c6 100644 --- a/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/event_firing_webdriver.robot @@ -15,7 +15,7 @@ Open Browser To Start Page ... LOG 1:20 DEBUG Wrapping driver to event_firing_webdriver. ... LOG 1:22 INFO Got driver also from SeleniumLibrary. Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... desired_capabilities=${DESIRED_CAPABILITIES} + ... executable_path=%{WEBDRIVERPATH} Event Firing Webdriver Go To (WebDriver) [Tags] NoGrid diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 854c63ba0..15aba3d4e 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:8 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:25 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index 384eb4410..8113dc84c 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -7,8 +7,10 @@ Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** Should Open Browser With Default Page Load Timeout [Documentation] Verify that 'Open Browser' changes the page load timeout. - ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} - ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 + ... LOG 1.1.1:33 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + ... LOG 1.1.1:35 DEBUG STARTS: Remote response: status=200 + # ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + # ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 Open Browser To Start Page Should Run Into Timeout Exception diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index 8899526a3..92631859d 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -13,6 +13,7 @@ Chrome Browser With Selenium Options As String ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options As String With Attirbute As True [Documentation] @@ -21,6 +22,7 @@ Chrome Browser With Selenium Options As String With Attirbute As True ... LOG 1:3 DEBUG GLOB: *"--headless"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid @@ -30,6 +32,7 @@ Chrome Browser With Selenium Options With Complex Object ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Object [Documentation] @@ -38,11 +41,13 @@ Chrome Browser With Selenium Options Object ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Invalid Method Run Keyword And Expect Error AttributeError: 'Options' object has no attribute 'not_here_method' ... Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=not_here_method("arg1") + ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options Argument With Semicolon @@ -51,3 +56,4 @@ Chrome Browser With Selenium Options Argument With Semicolon ... LOG 1:3 DEBUG GLOB: *["has;semicolon"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") + ... executable_path=%{WEBDRIVERPATH} diff --git a/atest/acceptance/open_and_close.robot b/atest/acceptance/open_and_close.robot index 5efd2d0d2..9bb13c01d 100644 --- a/atest/acceptance/open_and_close.robot +++ b/atest/acceptance/open_and_close.robot @@ -20,7 +20,7 @@ Browser Open With Not Well-Formed URL Should Close ... LOG 1.1:24 DEBUG REGEXP: .*but failed to open url.* ... LOG 2:2 DEBUG STARTS: DELETE ... LOG 2:5 DEBUG STARTS: Finished Request - Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} + Run Keyword And Expect Error * Open Browser bad.url.bad ${BROWSER} executable_path=%{WEBDRIVERPATH} Close All Browsers Switch to closed browser is possible diff --git a/atest/acceptance/remote_browsers.robot b/atest/acceptance/remote_browsers.robot.TRIAGE similarity index 100% rename from atest/acceptance/remote_browsers.robot rename to atest/acceptance/remote_browsers.robot.TRIAGE From 546d21d2a0038695038f9e43f5bc5cb02d4898f9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:20:18 -0400 Subject: [PATCH 141/407] Changed cookie expiry from hard-coded to tomorrow this time --- atest/acceptance/keywords/cookies.robot | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index a457842e5..a4cf9a0f8 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -4,6 +4,7 @@ Suite Setup Go To Page "cookies.html" Suite Teardown Delete All Cookies Test Setup Add Cookies Resource ../resource.robot +Library DateTime *** Test Cases *** Get Cookies @@ -120,4 +121,6 @@ Test Get Cookie Keyword Logging Add Cookies Delete All Cookies Add Cookie test seleniumlibrary - Add Cookie another value expiry=2023-10-29 19:36:51 + ${now} = Get Current Date + ${tomorrow_thistime} = Add Time To Date ${now} 1 day + Add Cookie another value expiry=${tomorrow_thistime} From 6ddfc24ebd449f7771deaa645394c8f106b590a7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 08:44:51 -0400 Subject: [PATCH 142/407] Updated cookie tests with expiry dates into 2024 --- atest/acceptance/keywords/cookies.robot | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index a4cf9a0f8..6a46d2877 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -36,15 +36,15 @@ Add Cookie When Secure Is False Should Be Equal ${cookie.secure} ${False} Add Cookie When Expiry Is Epoch - Add Cookie Cookie1 value1 expiry=1698601011 + Add Cookie Cookie1 value1 expiry=1730205247 ${cookie} = Get Cookie Cookie1 - ${expiry} = Convert Date ${1698601011} exclude_millis=True + ${expiry} = Convert Date ${1730205247} exclude_millis=True Should Be Equal As Strings ${cookie.expiry} ${expiry} Add Cookie When Expiry Is Human Readable Data&Time - Add Cookie Cookie12 value12 expiry=2023-10-29 19:36:51 + Add Cookie Cookie12 value12 expiry=2024-10-29 19:36:51 ${cookie} = Get Cookie Cookie12 - Should Be Equal As Strings ${cookie.expiry} 2023-10-29 19:36:51 + Should Be Equal As Strings ${cookie.expiry} 2024-10-29 19:36:51 Delete Cookie [Tags] Known Issue Safari @@ -72,7 +72,7 @@ Get Cookies As Dict When There Are None Test Get Cookie Object Expiry ${cookie} = Get Cookie another - Should Be Equal As Integers ${cookie.expiry.year} 2023 + Should Be Equal As Integers ${cookie.expiry.year} 2024 Should Be Equal As Integers ${cookie.expiry.month} 10 Should Be Equal As Integers ${cookie.expiry.day} 29 Should Be Equal As Integers ${cookie.expiry.hour} 19 @@ -113,7 +113,7 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2023-10-29 19:36:51 + ... expiry=2024-10-29 19:36:51 ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie another From 26ccf8874910adfcd05fad160de53ef746d3243b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 12:46:45 -0400 Subject: [PATCH 143/407] Fixed cookies tests where we needed aprior knowledge of expiry There were a couple tests when I updated the expiry date to variable based upon today had hard coded expected values. To fix I added another far in the future (from now) date to use for these few tests. This actually might be complicating things too much and instead just stay with anouther cookie and hard code it two years out. --- atest/acceptance/keywords/cookies.robot | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 6a46d2877..9e6f8cfa9 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -14,7 +14,7 @@ Get Cookies Get Cookies As Dict ${cookies}= Get Cookies as_dict=True - ${expected_cookies}= Create Dictionary test=seleniumlibrary another=value + ${expected_cookies}= Create Dictionary test=seleniumlibrary another=value far_future=timemachine Dictionaries Should Be Equal ${expected_cookies} ${cookies} App Sees Cookie Set By Selenium @@ -50,7 +50,7 @@ Delete Cookie [Tags] Known Issue Safari Delete Cookie test ${cookies} = Get Cookies - Should Be Equal ${cookies} another=value + Should Be Equal ${cookies} far_future=timemachine; another=value Non-existent Cookie Run Keyword And Expect Error @@ -72,12 +72,12 @@ Get Cookies As Dict When There Are None Test Get Cookie Object Expiry ${cookie} = Get Cookie another - Should Be Equal As Integers ${cookie.expiry.year} 2024 - Should Be Equal As Integers ${cookie.expiry.month} 10 - Should Be Equal As Integers ${cookie.expiry.day} 29 - Should Be Equal As Integers ${cookie.expiry.hour} 19 - Should Be Equal As Integers ${cookie.expiry.minute} 36 - Should Be Equal As Integers ${cookie.expiry.second} 51 + Should Be Equal As Integers ${cookie.expiry.year} ${tomorrow_thistime_datetime.year} + Should Be Equal As Integers ${cookie.expiry.month} ${tomorrow_thistime_datetime.month} + Should Be Equal As Integers ${cookie.expiry.day} ${tomorrow_thistime_datetime.day} + Should Be Equal As Integers ${cookie.expiry.hour} ${tomorrow_thistime_datetime.hour} + Should Be Equal As Integers ${cookie.expiry.minute} ${tomorrow_thistime_datetime.minute} + Should Be Equal As Integers ${cookie.expiry.second} ${tomorrow_thistime_datetime.second} Should Be Equal As Integers ${cookie.expiry.microsecond} 0 Test Get Cookie Object Domain @@ -113,9 +113,9 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2024-10-29 19:36:51 + ... expiry=2026-9-15 11:22:33 ... extra={'sameSite': 'Lax'} - ${cookie} = Get Cookie another + ${cookie} = Get Cookie far_future *** Keyword *** Add Cookies @@ -123,4 +123,7 @@ Add Cookies Add Cookie test seleniumlibrary ${now} = Get Current Date ${tomorrow_thistime} = Add Time To Date ${now} 1 day + ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime + Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} + Add Cookie far_future timemachine expiry=1789485753 # 2026-09-15 11:22:33 From 0c17cd69eb23b564657d0dfba948d519ddc21def Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 13:31:48 -0400 Subject: [PATCH 144/407] Fixed issue with Get Cookie logging assertions There was some missed chnages to the log. In addition, Chrome now has a limit on length of expiry with cookies. Its maximum length is 400 days, as per, https://developer.chrome.com/blog/cookie-max-age-expires/. As such back off the far future date to one just about a year out. Starting to think the hardcoded expiry is better in that one can immediately see it it verse the calculate some date in the future each time the test is run. Will revisit this in the future. --- atest/acceptance/keywords/cookies.robot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 9e6f8cfa9..4f341c05a 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -107,13 +107,13 @@ Test Get Cookie Object Value Test Get Cookie Keyword Logging [Tags] NoGrid Known Issue Firefox [Documentation] - ... LOG 1:5 ${cookie} = name=another - ... value=value + ... LOG 1:5 ${cookie} = name=far_future + ... value=timemachine ... path=/ ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2026-9-15 11:22:33 + ... expiry=2024-09-15 11:22:33 ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie far_future @@ -126,4 +126,4 @@ Add Cookies ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} - Add Cookie far_future timemachine expiry=1789485753 # 2026-09-15 11:22:33 + Add Cookie far_future timemachine expiry=1726413753 # 2024-09-15 11:22:33 From a3846e263528aa0dafd148e88ca516e5b48318cc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 13:53:41 -0400 Subject: [PATCH 145/407] Apparently need to deal with UTC time when dealing with cookie expiry --- atest/acceptance/keywords/cookies.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 4f341c05a..6ff52ccfb 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -126,4 +126,4 @@ Add Cookies ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} - Add Cookie far_future timemachine expiry=1726413753 # 2024-09-15 11:22:33 + Add Cookie far_future timemachine expiry=1726399353 # 2024-09-15 11:22:33 From 622d64e5d8856fd0a80e7bb1a0e34bc06ef31fb2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 14:45:03 -0400 Subject: [PATCH 146/407] Updated tested under Python versions to 3.8, 3.11, 3.12, pypy-3.9 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5d59b5c10..0e8dc4e6c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.7, 3.9, pypy-3.7] + python-version: [3.8, 3.11, 3.12, pypy-3.9] rf-version: [4.1.3, 5.0.1, 6.0.1] steps: From ced1630194d2b81be289b1772ad234e9c66827d5 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 15:28:19 -0400 Subject: [PATCH 147/407] Fixed conditions on multiple test runs to match newer Python versions Also allow for matrix to continue on failure so we can see all the error all at once and resolve them instead of doing it one at a time. --- .github/workflows/CI.yml | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0e8dc4e6c..815610541 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -6,6 +6,7 @@ jobs: build: runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: python-version: [3.8, 3.11, 3.12, pypy-3.9] @@ -35,7 +36,7 @@ jobs: python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Install dependencies for pypy - if: matrix.python-version == 'pypy-3.7' + if: matrix.python-version == 'pypy-3.9' run: | python -m pip install --upgrade pip pip install -r requirements.txt @@ -51,24 +52,21 @@ jobs: echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" - name: Generate stub file for ${{ matrix.python-version }} - if: matrix.python-version != 'pypy-3.7' + if: matrix.python-version != 'pypy-3.9' run: | invoke gen-stub - - name: Debugging - if: matrix.python-version != 'pypy-3.7' - run: | - which python - name: Run tests with headless Chrome and with PyPy - if: matrix.python-version == 'pypy-3.7' + if: matrix.python-version == 'pypy-3.9' run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome - - name: Run tests with normal Chrome and with Python 3.7 - if: matrix.python-version == '3.7' + - name: Run tests with normal Chrome if CPython + if: matrix.python-version != 'pypy-3.9' run: | xvfb-run --auto-servernum python atest/run.py --zip chrome + # Recognize for the moment this will NOT run as we aren't using Python 3.9 - name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3 if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3' run: | @@ -79,12 +77,12 @@ jobs: run: | xvfb-run --auto-servernum python atest/run.py --zip firefox - - name: Run tests with Selenium Grid - if: matrix.python-version == '3.8' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7' - run: | - wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar - sudo chmod u+x ./selenium-server-standalone.jar - xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True + # - name: Run tests with Selenium Grid + # if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7' + # run: | + # wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar + # sudo chmod u+x ./selenium-server-standalone.jar + # xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True - uses: actions/upload-artifact@v1 if: success() || failure() From 63be4350d7902929623a3c63b77acd79319e5471 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 31 Oct 2023 11:34:36 -0400 Subject: [PATCH 148/407] Temporarily removed inline flags for ignoring case on log statuschecker Due to an conflict with statuschecker and startingwith Python 3.11, inline flags, like `(?i)`, must be at the front of the regex. But statuschecker (v3.0.1) inserts a match begining of line to the start, thus violating this rule. Discussion have been had over with the status checker project on possible changes. So in the mean time going to remove these from the log status check. --- atest/acceptance/keywords/content_assertions.robot | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/keywords/content_assertions.robot b/atest/acceptance/keywords/content_assertions.robot index a9f53ec70..7e115b0e8 100644 --- a/atest/acceptance/keywords/content_assertions.robot +++ b/atest/acceptance/keywords/content_assertions.robot @@ -33,7 +33,7 @@ Page Should Contain Using Default Custom Log Level ... 'TRACE' - noting the excluded second argument for the `Page Should Contain` ... keyword) fails and the log contains the html content. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 2:19 TRACE REGEXP: (?i) + ... LOG 2:19 TRACE REGEXP: ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. ${old_level}= Set Log Level TRACE Page Should Contain non existing text @@ -53,7 +53,7 @@ Page Should Contain With Custom Log Level INFO [Tags] NoGrid [Documentation] Html content is shown at the explicitly specified INFO level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 1:18 INFO REGEXP: (?i) + ... LOG 1:18 INFO REGEXP: ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain non existing text INFO @@ -61,7 +61,7 @@ Page Should Contain With Custom Log Level WARN [Tags] NoGrid [Documentation] Html content is shown at the explicitly specified WARN level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 1:18 WARN REGEXP: (?i) + ... LOG 1:18 WARN REGEXP: ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain non existing text WARN @@ -69,7 +69,7 @@ Page Should Contain With Custom Log Level DEBUG [Tags] NoGrid [Documentation] Html content is shown at the explicitly specified DEBUG level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 1:18 DEBUG REGEXP: (?i) + ... LOG 1:18 DEBUG REGEXP: ... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not. Page Should Contain non existing text DEBUG @@ -77,7 +77,7 @@ Page Should Contain With Custom Log Level TRACE [Tags] NoGrid [Documentation] Html content is shown at the explicitly specified TRACE level. ... FAIL Page should have contained text 'non existing text' but did not. - ... LOG 2:19 TRACE REGEXP: (?i) + ... LOG 2:19 TRACE REGEXP: ... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not. Set Log Level TRACE Page Should Contain non existing text TRACE @@ -122,7 +122,7 @@ Page Should Not Contain Page Should Not Contain With Custom Log Level [Tags] NoGrid - [Documentation] LOG 1.1:13 DEBUG REGEXP: (?i) + [Documentation] LOG 1.1:13 DEBUG REGEXP: Run Keyword And Expect Error ... Page should not have contained text 'needle'. ... Page Should Not Contain needle DEBUG From 9b7756539d17b0fc22363b864408d8e59eeea574 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 31 Oct 2023 12:49:47 -0400 Subject: [PATCH 149/407] Updating atest for Python v3.11 tests --- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/keywords/choose_file.robot | 2 +- atest/acceptance/keywords/page_load_timeout.robot | 7 +++---- atest/acceptance/multiple_browsers_options.robot | 6 +++--- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 15aba3d4e..55604e27c 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -30,7 +30,7 @@ Create Webdriver With Bad Keyword Argument Dictionary [Documentation] Invalid arguments types ${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'} Should Be Equal ${status} FAIL - Should Match Regexp ${error} (TypeError: __init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) + Should Match Regexp ${error} (TypeError: WebDriver.__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) *** Keywords *** Set Driver Variables diff --git a/atest/acceptance/keywords/choose_file.robot b/atest/acceptance/keywords/choose_file.robot index b706dda55..89dc975fd 100644 --- a/atest/acceptance/keywords/choose_file.robot +++ b/atest/acceptance/keywords/choose_file.robot @@ -45,7 +45,7 @@ Choose File With Grid From Library Using SL choose_file method Input Text Should Work Same Way When Not Using Grid [Documentation] - ... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {"* + ... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {* ... LOG 1:9 DEBUG Finished Request ... LOG 1:10 DEBUG GLOB: POST*/session/*/value*"text": "* ... LOG 1:13 DEBUG Finished Request diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index 8113dc84c..6555267c1 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -7,10 +7,9 @@ Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** Should Open Browser With Default Page Load Timeout [Documentation] Verify that 'Open Browser' changes the page load timeout. - ... LOG 1.1.1:33 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} - ... LOG 1.1.1:35 DEBUG STARTS: Remote response: status=200 - # ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} - # ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200 + ... LOG 1.1.1:27 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + ... LOG 1.1.1:29 DEBUG STARTS: Remote response: status=200 + # Note: previous log check was 33 and 37. Recording to see if something is swtiching back and forth Open Browser To Start Page Should Run Into Timeout Exception diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index 92631859d..bcf5c1a33 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -15,13 +15,13 @@ Chrome Browser With Selenium Options As String ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") ... executable_path=%{WEBDRIVERPATH} -Chrome Browser With Selenium Options As String With Attirbute As True +Chrome Browser With Selenium Options As String With Attribute As True [Documentation] ... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"* ... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:3 DEBUG GLOB: *"--headless"* + ... LOG 1:3 DEBUG GLOB: *"--headless=new"* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True + ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" ) ... executable_path=%{WEBDRIVERPATH} Chrome Browser With Selenium Options With Complex Object From 9f0bc5d70ac24d4b4f236804f24af603ad451e5e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 31 Oct 2023 13:14:57 -0400 Subject: [PATCH 150/407] Guessing whether the issue was the directory ..?? --- atest/acceptance/multiple_browsers_service_log_path.robot | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/atest/acceptance/multiple_browsers_service_log_path.robot b/atest/acceptance/multiple_browsers_service_log_path.robot index cdbbfb563..1caa9cc20 100644 --- a/atest/acceptance/multiple_browsers_service_log_path.robot +++ b/atest/acceptance/multiple_browsers_service_log_path.robot @@ -7,20 +7,20 @@ First Browser With Service Log Path [Documentation] ... LOG 1:2 INFO STARTS: Browser driver log file created to: [Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}.log - Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}.log + Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}.log OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}.log Second Browser With Service Log Path And Index [Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}-1.log - Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}-{index}.log + Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}-{index}.log OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}-1.log Third Browser With Service Log Path And Index Should Not Overwrite [Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}-2.log - Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}-{index}.log + Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}-{index}.log OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}-2.log Fourth Browser With Service Log Path In Subfolder [Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/a_folder/${BROWSER}-1.log - Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=a_folder/${BROWSER}-{index}.log + Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/a_folder/${BROWSER}-{index}.log OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/a_folder/${BROWSER}-1.log From 7c9d557a2ad4a2a78654304c1603f73480cbe03b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 31 Oct 2023 14:25:27 -0400 Subject: [PATCH 151/407] Debugging --- atest/acceptance/multiple_browsers_service_log_path.robot | 2 ++ 1 file changed, 2 insertions(+) diff --git a/atest/acceptance/multiple_browsers_service_log_path.robot b/atest/acceptance/multiple_browsers_service_log_path.robot index 1caa9cc20..ee22a3b25 100644 --- a/atest/acceptance/multiple_browsers_service_log_path.robot +++ b/atest/acceptance/multiple_browsers_service_log_path.robot @@ -8,6 +8,8 @@ First Browser With Service Log Path ... LOG 1:2 INFO STARTS: Browser driver log file created to: [Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}.log Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}.log + OperatingSystem.List Directories In Directory ${OUTPUT DIR}/ + ${output}= OperatingSystem.Run ls -lh OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}.log Second Browser With Service Log Path And Index From dcff890abb3c1dea9f3fbad48043aabd75e01473 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 1 Nov 2023 08:25:08 -0400 Subject: [PATCH 152/407] Resolve issue with service log_path now log_output. --- .../keywords/webdrivertools/webdrivertools.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 09ff06a87..ebfaea57b 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -145,7 +145,15 @@ def create_chrome( return self._remote(remote_url, options=options) if not executable_path: executable_path = self._get_executable_path(webdriver.chrome.service.Service) - service = ChromeService(executable_path=executable_path, log_path=service_log_path) + # -- temporary fix to transition selenium to v4.13 from v4.11 and prior + from inspect import signature + sig = signature(ChromeService) + if 'log_output' in str(sig): + log_method = {'log_output': service_log_path} + else: + log_method = {'log_path': service_log_path} + # -- + service = ChromeService(executable_path=executable_path, **log_method) return webdriver.Chrome( options=options, service=service, From 5c263109c8e08e2f4f34698b4cd09d0a65d8eb0f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 1 Nov 2023 09:32:45 -0400 Subject: [PATCH 153/407] Minor adjusts to atests - Trying to match log output across both Python 4.11 and 4.8 - Update expected line containinglog message --- atest/acceptance/create_webdriver.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index 55604e27c..d82acb814 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -7,7 +7,7 @@ Library Collections Create Webdriver Creates Functioning WebDriver [Documentation] ... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver. - ... LOG 1:25 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. + ... LOG 1:19 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+. [Tags] Known Issue Internet Explorer Known Issue Safari [Setup] Set Driver Variables Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS} @@ -30,7 +30,7 @@ Create Webdriver With Bad Keyword Argument Dictionary [Documentation] Invalid arguments types ${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'} Should Be Equal ${status} FAIL - Should Match Regexp ${error} (TypeError: WebDriver.__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) + Should Match Regexp ${error} (TypeError: (?:WebDriver.)__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) *** Keywords *** Set Driver Variables From 8e05d890a2484fde166d1100e953541169544a1f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 1 Nov 2023 09:35:20 -0400 Subject: [PATCH 154/407] Ignore Python 3.12 and pypy-3.9 for now.. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 815610541..f2f7b08db 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.8, 3.11, 3.12, pypy-3.9] + python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [4.1.3, 5.0.1, 6.0.1] steps: From 00ea092d1435c74ad52a259de0cacb57af646140 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 1 Nov 2023 09:58:30 -0400 Subject: [PATCH 155/407] Needed to make regex group optional for Python 3.8 --- atest/acceptance/create_webdriver.robot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index d82acb814..ec62c1e99 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -30,7 +30,7 @@ Create Webdriver With Bad Keyword Argument Dictionary [Documentation] Invalid arguments types ${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'} Should Be Equal ${status} FAIL - Should Match Regexp ${error} (TypeError: (?:WebDriver.)__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) + Should Match Regexp ${error} (TypeError: (?:WebDriver.)?__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.) *** Keywords *** Set Driver Variables From 5da9e12b07c0f075859494659136d61241663437 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 1 Nov 2023 19:42:15 -0400 Subject: [PATCH 156/407] Updated documentation for expected value if attribute is not there --- src/SeleniumLibrary/keywords/element.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 7d16f8f36..140f527df 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -414,7 +414,8 @@ def get_dom_attribute( self, locator: Union[WebElement, str], attribute: str ) -> str: """Returns the value of ``attribute`` from the element ``locator``. `Get DOM Attribute` keyword - only returns attributes declared within the element's HTML markup. + only returns attributes declared within the element's HTML markup. If the requested attribute + is not there, the keyword returns ${None}. See the `Locating elements` section for details about the locator syntax. From fac5596d703f7a69e283ce33eeccc97e376a6474 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Mon, 6 Nov 2023 17:10:08 -0600 Subject: [PATCH 157/407] refactor inspect-based log method finder, use for firefox --- .../keywords/webdrivertools/webdrivertools.py | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 166338ca1..bab6f5839 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -131,6 +131,16 @@ def _remote_capabilities_resolver(self, set_capabilities, default_capabilities): caps["browserName"] = default_capabilities["browserName"] return {"desired_capabilities": caps} + def _get_log_method(service_cls, service_log_path): + # -- temporary fix to transition selenium to v4.13 from v4.11 and prior + from inspect import signature + sig = signature(service_cls) + if 'log_output' in str(sig): + return {'log_output': service_log_path} + else: + return {'log_path': service_log_path} + # -- + def create_chrome( self, desired_capabilities, @@ -145,14 +155,7 @@ def create_chrome( return self._remote(remote_url, options=options) if not executable_path: executable_path = self._get_executable_path(webdriver.chrome.service.Service) - # -- temporary fix to transition selenium to v4.13 from v4.11 and prior - from inspect import signature - sig = signature(ChromeService) - if 'log_output' in str(sig): - log_method = {'log_output': service_log_path} - else: - log_method = {'log_path': service_log_path} - # -- + log_method = self._get_log_method(ChromeService, service_log_path) service = ChromeService(executable_path=executable_path, **log_method) return webdriver.Chrome( options=options, @@ -203,12 +206,10 @@ def create_firefox( if remote_url: return self._remote(remote_url, options) - service_log_path = ( - service_log_path if service_log_path else self._geckodriver_log - ) if not executable_path: executable_path = self._get_executable_path(webdriver.firefox.service.Service) - service = FirefoxService(executable_path=executable_path, log_path=service_log_path) + log_method = self._get_log_method(FirefoxService, service_log_path or self._geckodriver_log) + service = FirefoxService(executable_path=executable_path, **log_method) return webdriver.Firefox( options=options, service=service, From eabebb2fcf17d897b6fc56991303f21afe5b4578 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Mon, 6 Nov 2023 17:24:24 -0600 Subject: [PATCH 158/407] apply log_method inspection for other drivers --- .../keywords/webdrivertools/webdrivertools.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index bab6f5839..31997d275 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -302,7 +302,8 @@ def create_edge( return self._remote(remote_url, options=options) if not executable_path: executable_path = self._get_executable_path(webdriver.edge.service.Service) - service = EdgeService(executable_path=executable_path, log_path=service_log_path) + log_method = self._get_log_method(EdgeService, service_log_path) + service = EdgeService(executable_path=executable_path, **log_method) return webdriver.Edge( options=options, service=service, @@ -323,7 +324,8 @@ def create_safari( return self._remote(remote_url, options=options) if not executable_path: executable_path = self._get_executable_path(webdriver.Safari) - service = SafariService(executable_path=executable_path, log_path=service_log_path) + log_method = self._get_log_method(SafariService, service_log_path) + service = SafariService(executable_path=executable_path, **log_method) return webdriver.Safari(options=options, service=service) def _remote(self, remote_url, options): From 83118c300a7460da319c2de76dcacdd8739c959e Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Mon, 6 Nov 2023 17:26:38 -0600 Subject: [PATCH 159/407] and ie --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 31997d275..765dc052d 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -277,7 +277,8 @@ def create_ie( return self._remote(remote_url, options=options) if not executable_path: executable_path = self._get_executable_path(webdriver.ie.service.Service) - service = IeService(executable_path=executable_path, log_path=service_log_path) + log_method = self._get_log_method(IeService, service_log_path) + service = IeService(executable_path=executable_path, **log_method) return webdriver.Ie( options=options, service=service, From e9b9d7babab4d2ba9826f1a95340da09d032da4b Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 8 Nov 2023 12:09:51 -0600 Subject: [PATCH 160/407] add self to _get_log_method --- src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 765dc052d..16e3d1f48 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -131,7 +131,7 @@ def _remote_capabilities_resolver(self, set_capabilities, default_capabilities): caps["browserName"] = default_capabilities["browserName"] return {"desired_capabilities": caps} - def _get_log_method(service_cls, service_log_path): + def _get_log_method(self, service_cls, service_log_path): # -- temporary fix to transition selenium to v4.13 from v4.11 and prior from inspect import signature sig = signature(service_cls) From e8bd21f7438c5e9b5f7baf7544db4333ed5ef2a6 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 9 Nov 2023 11:34:43 -0500 Subject: [PATCH 161/407] Added selenium versions to test matrix - Also documented some temporary changes to GitHub Actions test execution - Corrected pypy version in conditional check --- .github/workflows/CI.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f2f7b08db..294777a52 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,6 +11,7 @@ jobs: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [4.1.3, 5.0.1, 6.0.1] + selenium-version: [4.3.0, 4.12.0, 4.13.0, 4.14.0, 4.15.2] steps: - uses: actions/checkout@v3 @@ -42,6 +43,9 @@ jobs: pip install -r requirements.txt pip install robotstatuschecker>=1.4 pip install requests robotframework-pabot + - name: Install Seleninum v${{ matrix.selenium-version }} + run: | + pip install --upgrade selenium==${{ matrix.selenium-version }} - name: Install RF ${{ matrix.rf-version }} run: | pip install -U --pre robotframework==${{ matrix.rf-version }} @@ -56,6 +60,7 @@ jobs: run: | invoke gen-stub + # Temporarily ignoring pypy execution - name: Run tests with headless Chrome and with PyPy if: matrix.python-version == 'pypy-3.9' run: | @@ -78,7 +83,7 @@ jobs: xvfb-run --auto-servernum python atest/run.py --zip firefox # - name: Run tests with Selenium Grid - # if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7' + # if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9' # run: | # wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar # sudo chmod u+x ./selenium-server-standalone.jar From 8796cb7f39a287efe12c359f9b3131192f8dba00 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 9 Nov 2023 11:53:42 -0500 Subject: [PATCH 162/407] Don't use selenium-manager with Python v4.3.0 --- .github/workflows/CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 294777a52..ab357b5b1 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -50,6 +50,7 @@ jobs: run: | pip install -U --pre robotframework==${{ matrix.rf-version }} - name: Install drivers via selenium-manager + if: matrix.selenium-version != '4.3.0' run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" From 1220cdd5aabee54de04e2b914b77a4d527d300a1 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 9 Nov 2023 12:03:49 -0500 Subject: [PATCH 163/407] Removed Python versions 4.3.0, 4.12.0 from test matrix Removed python version greater than 60 days old --- .github/workflows/CI.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ab357b5b1..f147174e5 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [4.1.3, 5.0.1, 6.0.1] - selenium-version: [4.3.0, 4.12.0, 4.13.0, 4.14.0, 4.15.2] + selenium-version: [4.13.0, 4.14.0, 4.15.2] steps: - uses: actions/checkout@v3 @@ -50,7 +50,6 @@ jobs: run: | pip install -U --pre robotframework==${{ matrix.rf-version }} - name: Install drivers via selenium-manager - if: matrix.selenium-version != '4.3.0' run: | SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') echo "$SELENIUM_MANAGER_EXE" From b3007618d9d18dd3634ef5608fb79bcc8306e7ae Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 16:15:15 -0500 Subject: [PATCH 164/407] Cleaned up Get DOM Attribute, Get Property atests --- atest/acceptance/keywords/elements.robot | 55 +++++++++++++++++------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/atest/acceptance/keywords/elements.robot b/atest/acceptance/keywords/elements.robot index c548a2b7b..eb0bd76ac 100644 --- a/atest/acceptance/keywords/elements.robot +++ b/atest/acceptance/keywords/elements.robot @@ -3,6 +3,7 @@ Documentation Tests elements Test Setup Go To Page "links.html" Resource ../resource.robot Library String +Library DebugLibrary *** Test Cases *** Get Many Elements @@ -60,48 +61,72 @@ Get Element Attribute ${class}= Get Element Attribute ${second_div} class Should Be Equal ${class} Second Class +# About DOM Attributes and Properties +# ----------------------------------- +# When implementing the new `Get DOM Attirbute` and `Get Property` keywords (#1822), several +# questions were raised. Fundamentally what is the difference between a DOM attribute and +# a Property. As [1] explains "Attributes are defined by HTML. Properties are defined by the +# DOM (Document Object Model)." +# +# Below are some references which talk to some descriptions and oddities of DOM attributes +# and properties. +# +# References: +# [1] HTML attributes and DOM properties: +# https://angular.io/guide/binding-syntax#html-attribute-vs-dom-property +# [2] W3C HTML Specification - Section 13.1.2.3 Attributes: +# https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 +# [3] JavaScript.Info - Attributes and properties: +# https://javascript.info/dom-attributes-and-properties +# [4] "Which CSS properties are inherited?" - StackOverflow +# https://stackoverflow.com/questions/5612302/which-css-properties-are-inherited +# [5] MDN Web Docs: Attribute +# https://developer.mozilla.org/en-US/docs/Glossary/Attribute +# [6] MDN Web Docs: HTML attribute reference +# https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes + Get DOM Attribute + # Test get DOM attribute ${id}= Get DOM Attribute link:Link with id id Should Be Equal ${id} some_id # Test custom attribute ${existing_custom_attr}= Get DOM Attribute id:emptyDiv data-id - Should Be Equal ${existing_custom_attr} my_id + Should Be Equal ${existing_custom_attr} my_id ${doesnotexist_custom_attr}= Get DOM Attribute id:emptyDiv data-doesnotexist Should Be Equal ${doesnotexist_custom_attr} ${None} - # ToDo: - # Ref: https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 - -Get non existing DOM Attribute + # Get non existing DOM Attribute ${class}= Get DOM Attribute link:Link with id class Should Be Equal ${class} ${NONE} More DOM Attributes [Setup] Go To Page "forms/enabled_disabled_fields_form.html" - # Test get empty attribute + # Test get empty boolean attribute ${disabled}= Get DOM Attribute css:input[name="disabled_input"] disabled - Should Be Equal ${disabled} true # ${True} + Should Be Equal ${disabled} true + # Test boolean attribute whose value is a string ${disabled}= Get DOM Attribute css:input[name="disabled_password"] disabled - Should Be Equal ${disabled} true # disabled + Should Be Equal ${disabled} true # Test empty string as the value for the attribute ${empty_value}= Get DOM Attribute css:input[name="disabled_password"] value Should Be Equal ${empty_value} ${EMPTY} + # Test non-existing attribute ${disabled}= Get DOM Attribute css:input[name="enabled_password"] disabled - Should Be Equal ${disabled} ${NONE} # false + Should Be Equal ${disabled} ${NONE} Get Property [Setup] Go To Page "forms/enabled_disabled_fields_form.html" - # ${attributes}= Get Property css:input[name="readonly_empty"] attributes ${tagName_prop}= Get Property css:input[name="readonly_empty"] tagName Should Be Equal ${tagName_prop} INPUT # Get a boolean property ${isConnected}= Get Property css:input[name="readonly_empty"] isConnected Should Be Equal ${isConnected} ${True} - - # ToDo: nned to test own versus inherited property + # Test property which returns webelement + ${children_prop}= Get Property id:table1 children + Length Should Be ${children_prop} ${1} + ${isWebElement}= Evaluate isinstance($children_prop[0], selenium.webdriver.remote.webelement.WebElement) modules=selenium + Should Be Equal ${isWebElement} ${True} + # ToDo: need to test own versus inherited property # ToDo: Test enumerated property - # Test proprty which returns webelement - ${children}= Get Property id:table1 children - Get "Attribute" That Is Both An DOM Attribute and Property [Setup] Go To Page "forms/enabled_disabled_fields_form.html" From 4a1f413c4a4b29d196e76b8da5371019a23d3c32 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 16:17:02 -0500 Subject: [PATCH 165/407] Updated number of library keywords to 179 --- utest/test/api/test_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 89e33c247..b80581af1 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 179) def test_parse_library(self): plugin = "path.to.MyLibrary" From 6af2c8226a6d663df6073ff27b82014ca6259ba3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 16:37:25 -0500 Subject: [PATCH 166/407] Revert "Updated number of library keywords to 179" This reverts commit 4a1f413c4a4b29d196e76b8da5371019a23d3c32. --- utest/test/api/test_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index b80581af1..89e33c247 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 179) + self.assertEqual(len(sl.get_keyword_names()), 177) def test_parse_library(self): plugin = "path.to.MyLibrary" From bbb999001449f608cf269887b0d8792c73a2d92c Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 17:09:19 -0500 Subject: [PATCH 167/407] Updated number of library keywords to 179 --- utest/test/api/test_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 89e33c247..b80581af1 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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()), 179) def test_parse_library(self): plugin = "path.to.MyLibrary" From 7ab0a2c7ed5844abf8e3d424cbd73930c0606db8 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 17:37:01 -0500 Subject: [PATCH 168/407] Added test where the property is different than the attribute Using prefilled value on an input element, first verify that the value attribute and property are the same. Then modifying the value by inputting text verify the value property has changed but the attribute value remains the same. --- atest/acceptance/keywords/elements.robot | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/atest/acceptance/keywords/elements.robot b/atest/acceptance/keywords/elements.robot index eb0bd76ac..5419baa15 100644 --- a/atest/acceptance/keywords/elements.robot +++ b/atest/acceptance/keywords/elements.robot @@ -134,6 +134,19 @@ Get "Attribute" That Is Both An DOM Attribute and Property ${value_attribute}= Get DOM Attribute css:input[name="readonly_empty"] value Should Be Equal ${value_property} ${value_attribute} +Modify "Attribute" That Is Both An DOM Attribute and Property + [Setup] Go To Page "forms/prefilled_email_form.html" + ${initial_value_property}= Get Property css:input[name="email"] value + ${initial_value_attribute}= Get DOM Attribute css:input[name="email"] value + Should Be Equal ${initial_value_property} ${initial_value_attribute} + Should Be Equal ${initial_value_attribute} Prefilled Email + Input Text css:input[name="email"] robot@robotframework.org + ${changed_value_property}= Get Property css:input[name="email"] value + ${changed_value_attribute}= Get DOM Attribute css:input[name="email"] value + Should Not Be Equal ${changed_value_property} ${changed_value_attribute} + Should Be Equal ${changed_value_attribute} Prefilled Email + Should Be Equal ${changed_value_property} robot@robotframework.org + Get Element Attribute Value Should Be Should Be Succesfull Element Attribute Value Should Be link=Absolute external link href http://www.google.com/ Element Attribute Value Should Be link=Absolute external link nothere ${None} From 583c9e600378c716a64361ac783b52f74286c3c2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 20:29:33 -0500 Subject: [PATCH 169/407] Added dynamic and delayed title change as initial test framework for expected conditions --- atest/resources/html/javascript/dynamic_content.html | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/atest/resources/html/javascript/dynamic_content.html b/atest/resources/html/javascript/dynamic_content.html index 284d5d4ee..8c602cd64 100644 --- a/atest/resources/html/javascript/dynamic_content.html +++ b/atest/resources/html/javascript/dynamic_content.html @@ -10,10 +10,17 @@ container = document.getElementById(target_container); container.appendChild(p); } + + function delayed_title_change() { + setTimeout(function(){ + document.title='Delayed'; + },600); + } change title
+ delayed change title
add content
title to ääää

From 2b10abf0c9cdd7596ebaf17bfff0937b75e729c3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 22:12:10 -0500 Subject: [PATCH 170/407] Initial (working) prototype of wait for.. keyword Wanted to just throw out a sample test case, test application (page), and a working keyword. Interesting this works at a very basic level. See next paths for a few functionality like - instead of snake_case create method for using "space case" - add check for presence of method - add polling delay, timeout - ...? --- .../keywords/expected_conditions.robot | 11 ++++++++ src/SeleniumLibrary/__init__.py | 2 ++ src/SeleniumLibrary/keywords/__init__.py | 1 + .../keywords/expectedconditions.py | 25 +++++++++++++++++++ 4 files changed, 39 insertions(+) create mode 100644 atest/acceptance/keywords/expected_conditions.robot create mode 100644 src/SeleniumLibrary/keywords/expectedconditions.py diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot new file mode 100644 index 000000000..05a6496ab --- /dev/null +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -0,0 +1,11 @@ +*** Settings *** +Test Setup Go To Page "javascript/dynamic_content.html" +Resource ../resource.robot + +*** Test Cases *** +Wait For Expected Conditions One Argument + Title Should Be Original + Click Element link=delayed change title + Wait For Expected Condition title_is Delayed + Title Should Be Delayed + diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 5754cb0f0..3b781725d 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -35,6 +35,7 @@ BrowserManagementKeywords, CookieKeywords, ElementKeywords, + ExpectedConditionKeywords, FormElementKeywords, FrameKeywords, JavaScriptKeywords, @@ -490,6 +491,7 @@ def __init__( BrowserManagementKeywords(self), CookieKeywords(self), ElementKeywords(self), + ExpectedConditionKeywords(self), FormElementKeywords(self), FrameKeywords(self), JavaScriptKeywords(self), diff --git a/src/SeleniumLibrary/keywords/__init__.py b/src/SeleniumLibrary/keywords/__init__.py index 184efff14..fc9f357cf 100644 --- a/src/SeleniumLibrary/keywords/__init__.py +++ b/src/SeleniumLibrary/keywords/__init__.py @@ -18,6 +18,7 @@ from .browsermanagement import BrowserManagementKeywords # noqa from .cookie import CookieKeywords # noqa from .element import ElementKeywords # noqa +from .expectedconditions import ExpectedConditionKeywords # noqa from .formelement import FormElementKeywords # noqa from .frames import FrameKeywords # noqa from .javascript import JavaScriptKeywords # noqa diff --git a/src/SeleniumLibrary/keywords/expectedconditions.py b/src/SeleniumLibrary/keywords/expectedconditions.py new file mode 100644 index 000000000..fed8cfe21 --- /dev/null +++ b/src/SeleniumLibrary/keywords/expectedconditions.py @@ -0,0 +1,25 @@ +# Copyright 2016- Robot Framework Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from SeleniumLibrary.base import LibraryComponent, keyword +from selenium.webdriver.support.wait import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC + +class ExpectedConditionKeywords(LibraryComponent): + @keyword + def wait_for_expected_condition(self, condition, *args): + wait = WebDriverWait(self.driver, 10) + # import sys,pdb;pdb.Pdb(stdout=sys.__stdout__).set_trace() + c = getattr(EC, condition) + wait.until(c(*args)) \ No newline at end of file From eb49c98fc7d13b813752c56a47b0b526702bf5c6 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 22:38:26 -0500 Subject: [PATCH 171/407] Bumped number of library keywords by one --- utest/test/api/test_plugins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utest/test/api/test_plugins.py b/utest/test/api/test_plugins.py index 89e33c247..9b5a34f44 100644 --- a/utest/test/api/test_plugins.py +++ b/utest/test/api/test_plugins.py @@ -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" From 129e9b03e96556dc827a57e2e7ffe36f0c2f6842 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 10 Nov 2023 22:41:52 -0500 Subject: [PATCH 172/407] Moved previous expected condition tests out of current test suite These were some initial sketches for the keywords and their usage. As they are not working I have moved them out of the test suite. --- ...ected_conditions.robot => expected_conditions.robot.PROTOTYPE} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename atest/acceptance/{expected_conditions.robot => expected_conditions.robot.PROTOTYPE} (100%) diff --git a/atest/acceptance/expected_conditions.robot b/atest/acceptance/expected_conditions.robot.PROTOTYPE similarity index 100% rename from atest/acceptance/expected_conditions.robot rename to atest/acceptance/expected_conditions.robot.PROTOTYPE From 36e7da3832eb059cfbcac12cae45f2a2302bba5f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 11 Nov 2023 08:13:46 -0500 Subject: [PATCH 173/407] Adding another sample tests and modifying keyword behavior - Added 100 millisecond polling to wait. Seems like a good default. Will need to decide on how to let users set this. - Copied dynamic_content.html making into seperate expected_conditions.html test page. - Added another sample test case --- .../keywords/expected_conditions.robot | 8 ++- .../html/javascript/expected_conditions.html | 72 +++++++++++++++++++ .../keywords/expectedconditions.py | 2 +- 3 files changed, 79 insertions(+), 3 deletions(-) create mode 100644 atest/resources/html/javascript/expected_conditions.html diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot index 05a6496ab..b032aa7cd 100644 --- a/atest/acceptance/keywords/expected_conditions.robot +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -1,5 +1,5 @@ *** Settings *** -Test Setup Go To Page "javascript/dynamic_content.html" +Test Setup Go To Page "javascript/expected_conditions.html" Resource ../resource.robot *** Test Cases *** @@ -8,4 +8,8 @@ Wait For Expected Conditions One Argument Click Element link=delayed change title Wait For Expected Condition title_is Delayed Title Should Be Delayed - + +Wait For Expected Conditions using WebElement as locator + Click Button Change the button state + ${dynamic_btn}= Get WebElement id:enabledDisabledBtn + Wait For Expected Condition element_to_be_clickable ${dynamic_btn} diff --git a/atest/resources/html/javascript/expected_conditions.html b/atest/resources/html/javascript/expected_conditions.html new file mode 100644 index 000000000..9e2a38f39 --- /dev/null +++ b/atest/resources/html/javascript/expected_conditions.html @@ -0,0 +1,72 @@ + + + + + Original + + + + change title
+ delayed change title
+ add content
+ title to ääää
+

+ Change Title
+ Add Content
+

+
+
+
+
+
+ +
+

+ + +

+

+

+ + + + + + +
+

+ + + diff --git a/src/SeleniumLibrary/keywords/expectedconditions.py b/src/SeleniumLibrary/keywords/expectedconditions.py index fed8cfe21..94ce5da50 100644 --- a/src/SeleniumLibrary/keywords/expectedconditions.py +++ b/src/SeleniumLibrary/keywords/expectedconditions.py @@ -19,7 +19,7 @@ class ExpectedConditionKeywords(LibraryComponent): @keyword def wait_for_expected_condition(self, condition, *args): - wait = WebDriverWait(self.driver, 10) + wait = WebDriverWait(self.driver, 10, 0.1) # import sys,pdb;pdb.Pdb(stdout=sys.__stdout__).set_trace() c = getattr(EC, condition) wait.until(c(*args)) \ No newline at end of file From 48376f707985a9be74b821e1440fa8c62acec4d9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 11 Nov 2023 08:28:55 -0500 Subject: [PATCH 174/407] Added sample test case where an expected timeout would occur --- atest/acceptance/keywords/expected_conditions.robot | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot index b032aa7cd..a09283d2b 100644 --- a/atest/acceptance/keywords/expected_conditions.robot +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -9,6 +9,12 @@ Wait For Expected Conditions One Argument Wait For Expected Condition title_is Delayed Title Should Be Delayed +Wait For Expected Condition Times out + Title Should Be Original + Click Element link=delayed change title + Wait For Expected Condition title_is Foo + # Verify failure + Wait For Expected Conditions using WebElement as locator Click Button Change the button state ${dynamic_btn}= Get WebElement id:enabledDisabledBtn From 30834595a95658f967f0f20ffdfca7f8902e102d Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Wed, 15 Nov 2023 12:04:15 +0100 Subject: [PATCH 175/407] added timeout argument to keyword wait_for_expected_condition Added timeout atest --- atest/acceptance/keywords/expected_conditions.robot | 6 +++--- src/SeleniumLibrary/keywords/expectedconditions.py | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot index a09283d2b..f66f08e8c 100644 --- a/atest/acceptance/keywords/expected_conditions.robot +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -9,11 +9,11 @@ Wait For Expected Conditions One Argument Wait For Expected Condition title_is Delayed Title Should Be Delayed -Wait For Expected Condition Times out +Wait For Expected Condition Times out within set timeout + [Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.5* Title Should Be Original Click Element link=delayed change title - Wait For Expected Condition title_is Foo - # Verify failure + Wait For Expected Condition title_is Delayed timeout=0.5 Wait For Expected Conditions using WebElement as locator Click Button Change the button state diff --git a/src/SeleniumLibrary/keywords/expectedconditions.py b/src/SeleniumLibrary/keywords/expectedconditions.py index 94ce5da50..19b143b92 100644 --- a/src/SeleniumLibrary/keywords/expectedconditions.py +++ b/src/SeleniumLibrary/keywords/expectedconditions.py @@ -11,6 +11,8 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +import string +from typing import Optional from SeleniumLibrary.base import LibraryComponent, keyword from selenium.webdriver.support.wait import WebDriverWait @@ -18,8 +20,9 @@ class ExpectedConditionKeywords(LibraryComponent): @keyword - def wait_for_expected_condition(self, condition, *args): - wait = WebDriverWait(self.driver, 10, 0.1) + def wait_for_expected_condition(self, condition: string, *args, timeout: Optional[float]=10): + wait = WebDriverWait(self.driver, timeout, 0.1) # import sys,pdb;pdb.Pdb(stdout=sys.__stdout__).set_trace() c = getattr(EC, condition) - wait.until(c(*args)) \ No newline at end of file + result = wait.until(c(*args), message="Expected Condition not met within set timeout of " + str(timeout)) + return result From 1aa3d16f83b7a7cf2a4601752f0f2b00c2138461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81?= Date: Fri, 17 Nov 2023 16:32:36 +0100 Subject: [PATCH 176/407] fixed type hinting so that it is not converted to str MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: René --- atest/acceptance/keywords/async_javascript.robot | 8 ++++++++ atest/acceptance/keywords/javascript.robot | 8 ++++++++ src/SeleniumLibrary/keywords/javascript.py | 4 ++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/async_javascript.robot b/atest/acceptance/keywords/async_javascript.robot index 2a9f8fcbd..7fc72b198 100644 --- a/atest/acceptance/keywords/async_javascript.robot +++ b/atest/acceptance/keywords/async_javascript.robot @@ -19,6 +19,14 @@ Execute Async Javascript With ARGUMENTS and JAVASCRIPT Marker ... alert(arguments[0]); Alert Should Be Present 123 timeout=10 s +Execute Javascript with dictionary object + &{ARGS}= Create Dictionary key=value number=${1} boolean=${TRUE} + ${returned} Execute Async Javascript arguments[1](arguments[0]); ARGUMENTS ${ARGS} + Should Be True type($returned) == dict + Should Be Equal ${returned}[key] value + Should Be Equal ${returned}[number] ${1} + Should Be Equal ${returned}[boolean] ${TRUE} + Should Be Able To Return Javascript Primitives From Async Scripts Neither None Nor Undefined ${result} = Execute Async Javascript arguments[arguments.length - 1](123); Should Be Equal ${result} ${123} diff --git a/atest/acceptance/keywords/javascript.robot b/atest/acceptance/keywords/javascript.robot index 2a2195cb2..a8d61fa7f 100644 --- a/atest/acceptance/keywords/javascript.robot +++ b/atest/acceptance/keywords/javascript.robot @@ -85,6 +85,14 @@ Execute Javascript from File With ARGUMENTS Marker ... 123 Alert Should Be Present 123 timeout=10 s +Execute Javascript with dictionary object + &{ARGS}= Create Dictionary key=value number=${1} boolean=${TRUE} + ${returned} Execute JavaScript return arguments[0] ARGUMENTS ${ARGS} + Should Be True type($returned) == dict + Should Be Equal ${returned}[key] value + Should Be Equal ${returned}[number] ${1} + Should Be Equal ${returned}[boolean] ${TRUE} + Open Context Menu [Tags] Known Issue Safari Go To Page "javascript/context_menu.html" diff --git a/src/SeleniumLibrary/keywords/javascript.py b/src/SeleniumLibrary/keywords/javascript.py index 0c793d9a1..9c2bb1c90 100644 --- a/src/SeleniumLibrary/keywords/javascript.py +++ b/src/SeleniumLibrary/keywords/javascript.py @@ -30,7 +30,7 @@ class JavaScriptKeywords(LibraryComponent): arg_marker = "ARGUMENTS" @keyword - def execute_javascript(self, *code: Union[WebElement, str]) -> Any: + def execute_javascript(self, *code: Any) -> Any: """Executes the given JavaScript code with possible arguments. ``code`` may be divided into multiple cells in the test data and @@ -73,7 +73,7 @@ def execute_javascript(self, *code: Union[WebElement, str]) -> Any: return self.driver.execute_script(js_code, *js_args) @keyword - def execute_async_javascript(self, *code: Union[WebElement, str]) -> Any: + def execute_async_javascript(self, *code: Any) -> Any: """Executes asynchronous JavaScript code with possible arguments. Similar to `Execute Javascript` except that scripts executed with From 1a74bf81715096e5460edc718fef7209e141288a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 17 Nov 2023 14:23:50 -0500 Subject: [PATCH 177/407] Added type hint --- src/SeleniumLibrary/keywords/browsermanagement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index d4f563375..665ffe89b 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -334,7 +334,7 @@ def _make_new_browser( @keyword def create_webdriver( - self, driver_name: str, alias: Optional[str] = None, kwargs=None, **init_kwargs + self, driver_name: str, alias: Optional[str] = None, kwargs: Optional[dict] = None, **init_kwargs ) -> str: """Creates an instance of Selenium WebDriver. From c5a101c58aef32e298cc2cba1b8d70d486c77e19 Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Sat, 18 Nov 2023 11:50:16 +0100 Subject: [PATCH 178/407] added fix for Page Should Contain Element not accepting lists --- src/SeleniumLibrary/keywords/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 94a901dec..0baa1701e 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -143,7 +143,7 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"): @keyword def page_should_contain_element( self, - locator: Union[WebElement, str], + locator: Union[WebElement, str, list[Union[WebElement,str]]], message: Optional[str] = None, loglevel: str = "TRACE", limit: Optional[int] = None, From 9c522a28e46f3bc24deed9fefb2a06929e9a79ce Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Sat, 18 Nov 2023 11:53:26 +0100 Subject: [PATCH 179/407] added fix for Page Should Contain Element not accepting lists --- src/SeleniumLibrary/keywords/element.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 0baa1701e..92089c37c 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -143,7 +143,7 @@ def page_should_contain(self, text: str, loglevel: str = "TRACE"): @keyword def page_should_contain_element( self, - locator: Union[WebElement, str, list[Union[WebElement,str]]], + locator: Union[WebElement, str, List[Union[WebElement,str]]], message: Optional[str] = None, loglevel: str = "TRACE", limit: Optional[int] = None, From 684db2d25ccc9e9648c8d6bba082b1c3f4dbd39f Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Sat, 18 Nov 2023 14:37:05 +0100 Subject: [PATCH 180/407] added a test for using a WebElement as locator for Page Should Contain Element --- atest/acceptance/locators/locator_parsing.robot | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/atest/acceptance/locators/locator_parsing.robot b/atest/acceptance/locators/locator_parsing.robot index eca57d054..2efb1586f 100644 --- a/atest/acceptance/locators/locator_parsing.robot +++ b/atest/acceptance/locators/locator_parsing.robot @@ -52,6 +52,10 @@ Multiple Locators as a List should work ${locator_list} = Create List id:div_id ${element} id:bar=foo Page Should Contain Element ${locator_list} +WebElement as locator should work + ${element} = Get WebElement id:foo:bar + Page Should Contain Element ${element} + When One Of Locator From Multiple Locators Is Not Found Keyword Fails Run Keyword And Expect Error ... Element with locator 'id:not_here' not found. From f539edb598bb09a47ebfe591a129c062af052906 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Nov 2023 09:13:49 -0500 Subject: [PATCH 181/407] Added RF v6.1.1 to the test matrix --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f2f7b08db..5ecbed4ae 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 - rf-version: [4.1.3, 5.0.1, 6.0.1] + rf-version: [4.1.3, 5.0.1, 6.0.1, 6.1.1] steps: - uses: actions/checkout@v3 From 8dd4fe2e4a4b2e069b5e878141d45bf7956ca8be Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Nov 2023 22:08:58 -0500 Subject: [PATCH 182/407] Release notes for 6.2.0rc1 --- docs/SeleniumLibrary-6.2.0rc1.rst | 127 ++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 docs/SeleniumLibrary-6.2.0rc1.rst diff --git a/docs/SeleniumLibrary-6.2.0rc1.rst b/docs/SeleniumLibrary-6.2.0rc1.rst new file mode 100644 index 000000000..2de9c477f --- /dev/null +++ b/docs/SeleniumLibrary-6.2.0rc1.rst @@ -0,0 +1,127 @@ +======================== +SeleniumLibrary 6.2.0rc1 +======================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.2.0rc1 is a new release with +compatability fixes for recent selenium versions and some bug fixes. + +All issues targeted for SeleniumLibrary v6.2.0 can be found +from the `issue tracker`_. + +If you have pip_ installed, just run + +:: + + pip install --pre --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.2.0rc1 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.2.0rc1 was released on Saturday November 18, 2023. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.12.0 through 4.15.2 and +Robot Framework 5.0.1 and 6.1.1. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.2.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Remove deprecated headless option for chrome and firefox. (`#1858`_, rc 1) + If one specified either `headlesschrome` or `headlessfirefox` as the browser within the + Open Browser keyword, then the library would handle setting this option with the underlying + Selenium driver. But the methods to do so were depracted and then removed in Selenium + v4.13.0. Thus one was not getting a headless browser in these instances. This resolves that + issue. + +- Resolve issue with service log_path now log_output. (`#1870`_, rc 1) + Selenium changed the arguments for the service log within v4.13.0. This change allows for a + seamless usage across versions before and after v4.13.0. + +- Execute JavaScript converts arguments to strings with robot==6.1 (`#1843`_, rc 1) + If any ARGUMENTS were passed into either the `Execute Javascript` or `Execute Async Javascript` + then they were converted to strings even if they were of some other type. This has been + corrected within this release. + +Acknowledgements +================ + +I want to thank the following for helping to get out this release, + +- `René Rohner `_ for pointing out that Create Webdriver had a + mutable default value (`#1817`_) +- `Kieran Trautwein `_ for resolving the issue with + deprecated headless option for chrome and firefox. (`#1858`_, rc 1) +- `Nicholas Bollweg `_ for assisting in resolving the issue + with service log_path now log_output. (`#1870`_, rc 1) +- `Igor Kozyrenko `_ for reporting the argument issue with Execute + JavaScript and `René Rohner `_for resolving it. (`#1843`_, rc 1) +- `Robin Matz `_ for improving the documentation on page load + timeout (`#1821`_, rc 1) + +and **Yuri Verweij, Lisa Crispin, and Tatu Aalto**. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + - Added + * - `#1817`_ + - bug + - critical + - Create Webdriver has mutable default value + - rc�1 + * - `#1858`_ + - bug + - critical + - Remove deprecated headless option for chrome and firefox. + - rc�1 + * - `#1870`_ + - bug + - critical + - Resolve issue with service log_path now log_output. + - rc�1 + * - `#1843`_ + - bug + - high + - Execute JavaScript converts arguments to strings with robot==6.1 + - rc�1 + * - `#1821`_ + - enhancement + - medium + - Improve documentation on page load timeout + - rc�1 + +Altogether 5 issues. View on the `issue tracker `__. + +.. _#1817: https://github.com/robotframework/SeleniumLibrary/issues/1817 +.. _#1858: https://github.com/robotframework/SeleniumLibrary/issues/1858 +.. _#1870: https://github.com/robotframework/SeleniumLibrary/issues/1870 +.. _#1843: https://github.com/robotframework/SeleniumLibrary/issues/1843 +.. _#1821: https://github.com/robotframework/SeleniumLibrary/issues/1821 From 7469076038c40da149504f6596813979630d62d3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Nov 2023 22:09:47 -0500 Subject: [PATCH 183/407] Updated version to 6.2.0rc1 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 5754cb0f0..a418e2839 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -51,7 +51,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.1.3" +__version__ = "6.2.0rc1" class SeleniumLibrary(DynamicCore): From 5874349f7995f60a3232ec3ffd818f31b6871e53 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Nov 2023 22:10:35 -0500 Subject: [PATCH 184/407] Generate stub file for 6.2.0rc1 --- src/SeleniumLibrary/__init__.pyi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index eedbad5ab..3f651199a 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -27,7 +27,7 @@ class SeleniumLibrary: def close_browser(self): ... def close_window(self): ... def cover_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def create_webdriver(self, driver_name: str, alias: Optional[Optional[str]] = None, kwargs = {}, **init_kwargs): ... + def create_webdriver(self, driver_name: str, alias: Optional[Optional[str]] = None, kwargs: Optional[Optional[dict]] = None, **init_kwargs): ... def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... def delete_all_cookies(self): ... @@ -45,8 +45,8 @@ class SeleniumLibrary: def element_should_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... def element_text_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... def element_text_should_not_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], not_expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... - def execute_async_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def execute_javascript(self, *code: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def execute_async_javascript(self, *code: Any): ... + def execute_javascript(self, *code: Any): ... def frame_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, loglevel: str = 'TRACE'): ... def get_action_chain_delay(self): ... def get_all_links(self): ... From 485151eb66e4c9927cc9955f6d03d374f8ed6c87 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 18 Nov 2023 22:12:00 -0500 Subject: [PATCH 185/407] Generated docs for version 6.2.0rc1 --- docs/SeleniumLibrary-6.2.0rc1.html | 1852 ++++++++++++++++++++++++++++ 1 file changed, 1852 insertions(+) create mode 100644 docs/SeleniumLibrary-6.2.0rc1.html diff --git a/docs/SeleniumLibrary-6.2.0rc1.html b/docs/SeleniumLibrary-6.2.0rc1.html new file mode 100644 index 000000000..6057aac57 --- /dev/null +++ b/docs/SeleniumLibrary-6.2.0rc1.html @@ -0,0 +1,1852 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From 98d8f89878bb03432ca1daf08ea0a02c4173d973 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 22 Nov 2023 09:52:46 -0500 Subject: [PATCH 186/407] Some intial parsing and validation for parsing condition argument --- .../keywords/expectedconditions.py | 4 +++ .../test/keywords/test_expectedconditions.py | 31 +++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 utest/test/keywords/test_expectedconditions.py diff --git a/src/SeleniumLibrary/keywords/expectedconditions.py b/src/SeleniumLibrary/keywords/expectedconditions.py index 19b143b92..01a426ff8 100644 --- a/src/SeleniumLibrary/keywords/expectedconditions.py +++ b/src/SeleniumLibrary/keywords/expectedconditions.py @@ -26,3 +26,7 @@ def wait_for_expected_condition(self, condition: string, *args, timeout: Optiona c = getattr(EC, condition) result = wait.until(c(*args), message="Expected Condition not met within set timeout of " + str(timeout)) return result + + def _parse_condition(self, condition: string): + parsed = condition.replace(' ','_').lower() + return parsed \ No newline at end of file diff --git a/utest/test/keywords/test_expectedconditions.py b/utest/test/keywords/test_expectedconditions.py new file mode 100644 index 000000000..3ade2e5fa --- /dev/null +++ b/utest/test/keywords/test_expectedconditions.py @@ -0,0 +1,31 @@ +import unittest + +from SeleniumLibrary.keywords import ExpectedConditionKeywords + +# Test cases + +# Parsing expected condition +# expect to match .. +# element_to_be_clickable +# Element To Be Clickable +# eLEment TO be ClIcKable +# expect to not match .. +# element__to_be_clickable +# elementtobeclickable +# element_to_be_clickble +# Ice Cream Cone Has Three Scopes + +# what about ..? +# ${ec_var} +# Element\ To\ Be\ Clickable +# Element${SPACE}To${SPACE}Be${SPACE}Clickable + +class ExpectedConditionKeywords(unittest.TestCase): + @classmethod + def setUpClass(cls): + cls.ec_keywords = ExpectedConditionKeywords(None) + + def WorkInProgresstest_parse_condition(self): + results = [] + results.append(self.ec_keywords._parse_condition("Element To Be Clickable")) + results.append(self.ec_keywords._parse_condition("eLEment TO be ClIcKable")) From c052133c9ff097d5756587376de4d7ff51659e42 Mon Sep 17 00:00:00 2001 From: Dor Blayzer <59066376+Dor-bl@users.noreply.github.com> Date: Thu, 23 Nov 2023 10:52:18 +0200 Subject: [PATCH 187/407] fix: Selenium CI badge show wrong status --- README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 24a36213c..6948a9ea5 100644 --- a/README.rst +++ b/README.rst @@ -28,8 +28,8 @@ different versions and the overall project history. .. image:: https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg :target: https://www.apache.org/licenses/LICENSE-2.0 -.. image:: https://github.com/robotframework/SeleniumLibrary/workflows/SeleniumLibrary%20CI/badge.svg - :target: https://github.com/robotframework/SeleniumLibrary/actions?query=workflow%3A%22SeleniumLibrary+CI%22 +.. image:: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master + :target: https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml Keyword Documentation --------------------- From af4df69966be5658cfab1b5204f874e46f8a2cea Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 24 Nov 2023 21:14:02 -0500 Subject: [PATCH 188/407] Release notes for 6.2.0 --- docs/SeleniumLibrary-6.2.0.rst | 124 +++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 docs/SeleniumLibrary-6.2.0.rst diff --git a/docs/SeleniumLibrary-6.2.0.rst b/docs/SeleniumLibrary-6.2.0.rst new file mode 100644 index 000000000..542bb66a1 --- /dev/null +++ b/docs/SeleniumLibrary-6.2.0.rst @@ -0,0 +1,124 @@ +===================== +SeleniumLibrary 6.2.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.2.0 is a new release with +compatibility fixes for recent selenium versions and some bug fixes. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.2.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.2.0 was released on Friday November 24, 2023. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.12.0 through 4.15.2 and +Robot Framework 5.0.1 and 6.1.1. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.2.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Remove deprecated headless option for chrome and firefox. (`#1858`_) + If one specified either `headlesschrome` or `headlessfirefox` as the browser within the + Open Browser keyword, then the library would handle setting this option with the underlying + Selenium driver. But the methods to do so were depracted and then removed in Selenium + v4.13.0. Thus one was not getting a headless browser in these instances. This resolves that + issue. + +- Resolve issue with service log_path now log_output. (`#1870`_) + Selenium changed the arguments for the service log within v4.13.0. This change allows for a + seamless usage across versions before and after v4.13.0. + +- Execute JavaScript converts arguments to strings with robot==6.1 (`#1843`_) + If any ARGUMENTS were passed into either the `Execute Javascript` or `Execute Async Javascript` + then they were converted to strings even if they were of some other type. This has been + corrected within this release. + +Acknowledgements +================ + +I want to thank the following for helping to get out this release, + +- `René Rohner `_ for pointing out that Create Webdriver had a + mutable default value (`#1817`_) +- `Kieran Trautwein `_ for resolving the issue with + deprecated headless option for chrome and firefox. (`#1858`_) +- `Nicholas Bollweg `_ for assisting in resolving the issue + with service log_path now log_output. (`#1870`_) +- `Igor Kozyrenko `_ for reporting the argument issue with Execute + JavaScript and `René Rohner `_for resolving it. (`#1843`_) +- `Robin Matz `_ for improving the documentation on page load + timeout (`#1821`_) +- `Dor Blayzer `_ for reporting and fixing the SeleniumLibrary CI badge. () + +and **Yuri Verweij, Lisa Crispin, and Tatu Aalto**. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1817`_ + - bug + - critical + - Create Webdriver has mutable default value + * - `#1858`_ + - bug + - critical + - Remove deprecated headless option for chrome and firefox. + * - `#1870`_ + - bug + - critical + - Resolve issue with service log_path now log_output. + * - `#1843`_ + - bug + - high + - Execute JavaScript converts arguments to strings with robot==6.1 + * - `#1821`_ + - enhancement + - medium + - Improve documentation on page load timeout + * - `#1872`_ + - --- + - medium + - fix: Selenium CI badge show wrong status + +Altogether 6 issues. View on the `issue tracker `__. + +.. _#1817: https://github.com/robotframework/SeleniumLibrary/issues/1817 +.. _#1858: https://github.com/robotframework/SeleniumLibrary/issues/1858 +.. _#1870: https://github.com/robotframework/SeleniumLibrary/issues/1870 +.. _#1843: https://github.com/robotframework/SeleniumLibrary/issues/1843 +.. _#1821: https://github.com/robotframework/SeleniumLibrary/issues/1821 +.. _#1872: https://github.com/robotframework/SeleniumLibrary/issues/1872 From fbfaadc3b999b497c9a94ba20bdb356f2e4c69c3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 24 Nov 2023 21:14:41 -0500 Subject: [PATCH 189/407] Updated version to 6.2.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index a418e2839..52dedf5d0 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -51,7 +51,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.2.0rc1" +__version__ = "6.2.0" class SeleniumLibrary(DynamicCore): From 7496dc7ee862926a50ad9c4c0f1549ead6029309 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 24 Nov 2023 21:15:59 -0500 Subject: [PATCH 190/407] Generated docs for version 6.2.0 --- docs/SeleniumLibrary.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 856f1d547..00db82f92 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1181,7 +1181,7 @@ jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a change title
delayed change title
+ delayed add element
add content
title to ääää

@@ -56,6 +76,9 @@

+

+

+

From bffa73084380c785092b99eda006893d6398e2ea Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Tue, 13 Feb 2024 09:58:24 +0100 Subject: [PATCH 216/407] updated *** Setting/Keyword/Variable *** to *** Settings/Keywords/Variables *** --- .../resource_event_firing_webdriver.robot | 2 +- atest/acceptance/__init__.robot | 2 +- atest/acceptance/big_list_of_naught_strings.robot | 2 +- atest/acceptance/create_webdriver.robot | 2 +- atest/acceptance/keywords/cookies.robot | 4 ++-- atest/acceptance/keywords/frames.robot | 2 +- atest/acceptance/keywords/textfields.robot | 2 +- atest/acceptance/keywords/textfields_html5.robot | 2 +- atest/acceptance/multiple_browsers_multiple_windows.robot | 2 +- atest/acceptance/resource.robot | 6 +++--- atest/acceptance/windows.robot | 2 +- 11 files changed, 14 insertions(+), 14 deletions(-) diff --git a/atest/acceptance/2-event_firing_webdriver/resource_event_firing_webdriver.robot b/atest/acceptance/2-event_firing_webdriver/resource_event_firing_webdriver.robot index ac68038d0..a224bc9bd 100644 --- a/atest/acceptance/2-event_firing_webdriver/resource_event_firing_webdriver.robot +++ b/atest/acceptance/2-event_firing_webdriver/resource_event_firing_webdriver.robot @@ -6,7 +6,7 @@ ${DESIRED_CAPABILITIES}= ${NONE} ${ROOT}= http://${SERVER}/html ${FRONT_PAGE}= ${ROOT}/ -*** Keyword *** +*** Keywords *** Go To Page "${relative url}" [Documentation] Goes to page diff --git a/atest/acceptance/__init__.robot b/atest/acceptance/__init__.robot index 632c26b08..cc9186ad0 100644 --- a/atest/acceptance/__init__.robot +++ b/atest/acceptance/__init__.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Resource resource.robot Force Tags Regression diff --git a/atest/acceptance/big_list_of_naught_strings.robot b/atest/acceptance/big_list_of_naught_strings.robot index 3ab67c007..fbfaf6f22 100644 --- a/atest/acceptance/big_list_of_naught_strings.robot +++ b/atest/acceptance/big_list_of_naught_strings.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Resource resource.robot Library BigListOfNaughtyStrings.BigListOfNaughtyStrings WITH NAME blns diff --git a/atest/acceptance/create_webdriver.robot b/atest/acceptance/create_webdriver.robot index ec62c1e99..0ee079522 100644 --- a/atest/acceptance/create_webdriver.robot +++ b/atest/acceptance/create_webdriver.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Documentation Tests Webdriver Resource resource.robot Library Collections diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index e00f73c32..23e2d6e05 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Documentation Tests cookies Suite Setup Go To Page "cookies.html" Suite Teardown Delete All Cookies @@ -117,7 +117,7 @@ Test Get Cookie Keyword Logging ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie far_future -*** Keyword *** +*** Keywords *** Add Cookies Delete All Cookies Add Cookie test seleniumlibrary diff --git a/atest/acceptance/keywords/frames.robot b/atest/acceptance/keywords/frames.robot index 0e0c10e61..c9d65d1e3 100644 --- a/atest/acceptance/keywords/frames.robot +++ b/atest/acceptance/keywords/frames.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Documentation Tests frames Test Setup Go To Page "frames/frameset.html" Test Teardown UnSelect Frame diff --git a/atest/acceptance/keywords/textfields.robot b/atest/acceptance/keywords/textfields.robot index cd7987804..1fa6f4522 100644 --- a/atest/acceptance/keywords/textfields.robot +++ b/atest/acceptance/keywords/textfields.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Test Setup Go To Page "forms/prefilled_email_form.html" Resource ../resource.robot Force Tags Known Issue Internet Explorer diff --git a/atest/acceptance/keywords/textfields_html5.robot b/atest/acceptance/keywords/textfields_html5.robot index 72ebe41ac..be8901134 100644 --- a/atest/acceptance/keywords/textfields_html5.robot +++ b/atest/acceptance/keywords/textfields_html5.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Test Setup Go To Page "forms/html5_input_types.html" Resource ../resource.robot diff --git a/atest/acceptance/multiple_browsers_multiple_windows.robot b/atest/acceptance/multiple_browsers_multiple_windows.robot index ceb0c2035..a8837965e 100644 --- a/atest/acceptance/multiple_browsers_multiple_windows.robot +++ b/atest/acceptance/multiple_browsers_multiple_windows.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Documentation These tests must open own browser because windows opened by ... earlier tests would otherwise be visible to Get Window XXX keywords ... even if those windows were closed. diff --git a/atest/acceptance/resource.robot b/atest/acceptance/resource.robot index 2ff32f7c8..4bcaf38eb 100644 --- a/atest/acceptance/resource.robot +++ b/atest/acceptance/resource.robot @@ -1,10 +1,10 @@ -*** Setting *** +*** Settings *** Library SeleniumLibrary run_on_failure=Nothing implicit_wait=0.2 seconds Library Collections Library OperatingSystem Library DateTime -*** Variable *** +*** Variables *** ${SERVER}= localhost:7000 ${BROWSER}= firefox ${REMOTE_URL}= ${NONE} @@ -13,7 +13,7 @@ ${ROOT}= http://${SERVER}/html ${FRONT_PAGE}= ${ROOT}/ ${SPEED}= 0 -*** Keyword *** +*** Keywords *** Open Browser To Start Page [Documentation] This keyword also tests 'Set Selenium Speed' and 'Set Selenium Timeout' ... against all reason. diff --git a/atest/acceptance/windows.robot b/atest/acceptance/windows.robot index bf96eb67b..25b6ab1f4 100644 --- a/atest/acceptance/windows.robot +++ b/atest/acceptance/windows.robot @@ -1,4 +1,4 @@ -*** Setting *** +*** Settings *** Documentation These tests must open own browser because windows opened by ... earlier tests would otherwise be visible to Get Window XXX keywords ... even if those windows were closed. From 6f9954be92228ec67ac93586190443b74a1f04d4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 17 Feb 2024 09:38:52 -0500 Subject: [PATCH 217/407] Initial retry of creating a Service class Working on an issue with the Options class gave me deeper insight into how it was working. Brought that experience over to the Service class. Thjis is an initial implementation / rewrite of the Service class. It follows more closely the options class. There is just the one test for now and I see I need to bring in the service argument into Open Browser but this feels like a good start. --- atest/acceptance/browser_service.robot | 9 + .../keywords/webdrivertools/webdrivertools.py | 183 ++++++++++++++---- 2 files changed, 155 insertions(+), 37 deletions(-) create mode 100644 atest/acceptance/browser_service.robot diff --git a/atest/acceptance/browser_service.robot b/atest/acceptance/browser_service.robot new file mode 100644 index 000000000..716973c31 --- /dev/null +++ b/atest/acceptance/browser_service.robot @@ -0,0 +1,9 @@ +*** Settings *** +Suite Teardown Close All Browsers +Resource resource.robot +Documentation These tests check the service argument of Open Browser. + +*** Test Cases *** +Browser With Selenium Service As String + Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} + ... service=port=1234; executable_path = '/path/to/driver/executable' diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 16e3d1f48..d4d7da6d2 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -444,16 +444,18 @@ def _get_index(self, alias_or_index): except ValueError: return None -# Temporarily removing as not going to use with initial 4.10.0 hotfixq -# class SeleniumService: -# """ executable_path: str = DEFAULT_EXECUTABLE_PATH, -# port: int = 0, -# log_path: typing.Optional[str] = None, -# service_args: typing.Optional[typing.List[str]] = None, -# env: typing.Optional[typing.Mapping[str, str]] = None, -# **kwargs, - -# executable_path = None, port, service_log_path, service_args, env +class SeleniumService: + """ + + """ + # """ executable_path: str = DEFAULT_EXECUTABLE_PATH, + # port: int = 0, + # log_path: typing.Optional[str] = None, + # service_args: typing.Optional[typing.List[str]] = None, + # env: typing.Optional[typing.Mapping[str, str]] = None, + # **kwargs, + # + # executable_path = None, port, service_log_path, service_args, env # """ # def create(self, browser, # executable_path=None, @@ -464,33 +466,110 @@ def _get_index(self, alias_or_index): # start_error_message=None, # chromium, chrome, edge # quiet=False, reuse_service=False, # safari # ): -# selenium_service = self._import_service(browser) -# # chrome, chromium, firefox, edge -# if any(chromium_based in browser.lower() for chromium_based in ('chromium', 'chrome', 'edge')): -# service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, -# service_args=service_args,env=env,start_error_message=start_error_message -# ) -# return service -# elif 'safari' in browser.lower(): -# service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, -# service_args=service_args,env=env,quiet=quiet,reuse_service=reuse_service -# ) -# return service -# elif 'firefox' in browser.lower(): -# service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, -# service_args=service_args,env=env -# ) -# return service -# else: -# service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, -# service_args=service_args,env=env -# ) -# return service - -# def _import_service(self, browser): -# browser = browser.replace("headless_", "", 1) -# service = importlib.import_module(f"selenium.webdriver.{browser}.service") -# return service.Service + def create(self, browser, service): + if not service: + return None + selenium_service = self._import_service(browser) + if not isinstance(service, str): + return service + + # Throw error is used with remote .. "They cannot be used with a Remote WebDriver session." [ref doc] + attrs = self._parse(service) + selenium_service_inst = selenium_service() + for attr in attrs: + for key in attr: + ser_attr = getattr(selenium_service_inst, key) + if callable(ser_attr): + ser_attr(*attr[key]) + else: + setattr(selenium_service_inst, key, *attr[key]) + return selenium_service_inst + + # # chrome, chromium, firefox, edge + # if any(chromium_based in browser.lower() for chromium_based in ('chromium', 'chrome', 'edge')): + # service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, + # service_args=service_args,env=env,start_error_message=start_error_message + # ) + # return service + # elif 'safari' in browser.lower(): + # service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, + # service_args=service_args,env=env,quiet=quiet,reuse_service=reuse_service + # ) + # return service + # elif 'firefox' in browser.lower(): + # service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, + # service_args=service_args,env=env + # ) + # return service + # else: + # service = selenium_service(executable_path=executable_path, port=port,log_path=service_log_path, + # service_args=service_args,env=env + # ) + # return service + + def _parse(self, service): + result = [] + for item in self._split(service): + try: + result.append(self._parse_to_tokens(item)) + except (ValueError, SyntaxError): + raise ValueError(f'Unable to parse service: "{item}"') + return result + + def _import_service(self, browser): + browser = browser.replace("headless_", "", 1) + # Throw error is used with remote .. "They cannot be used with a Remote WebDriver session." [ref doc] + service = importlib.import_module(f"selenium.webdriver.{browser}.service") + return service.Service + + def _parse_to_tokens(self, item): + result = {} + index, method = self._get_arument_index(item) + if index == -1: + result[item] = [] + return result + if method: + args_as_string = item[index + 1 : -1].strip() + if args_as_string: + args = ast.literal_eval(args_as_string) + else: + args = args_as_string + is_tuple = args_as_string.startswith("(") + else: + args_as_string = item[index + 1 :].strip() + args = ast.literal_eval(args_as_string) + is_tuple = args_as_string.startswith("(") + method_or_attribute = item[:index].strip() + result[method_or_attribute] = self._parse_arguments(args, is_tuple) + return result + + def _parse_arguments(self, argument, is_tuple=False): + if argument == "": + return [] + if is_tuple: + return [argument] + if not is_tuple and isinstance(argument, tuple): + return list(argument) + return [argument] + + def _get_arument_index(self, item): + if "=" not in item: + return item.find("("), True + if "(" not in item: + return item.find("="), False + index = min(item.find("("), item.find("=")) + return index, item.find("(") == index + + def _split(self, service): + split_service = [] + start_position = 0 + tokens = generate_tokens(StringIO(service).readline) + for toknum, tokval, tokpos, _, _ in tokens: + if toknum == token.OP and tokval == ";": + split_service.append(service[start_position : tokpos[1]].strip()) + start_position = tokpos[1] + 1 + split_service.append(options[start_position:]) + return split_service class SeleniumOptions: def create(self, browser, options): @@ -515,6 +594,36 @@ def _import_options(self, browser): options = importlib.import_module(f"selenium.webdriver.{browser}.options") return options.Options + def _parse_to_tokens(self, item): + result = {} + index, method = self._get_arument_index(item) + if index == -1: + result[item] = [] + return result + if method: + args_as_string = item[index + 1 : -1].strip() + if args_as_string: + args = ast.literal_eval(args_as_string) + else: + args = args_as_string + is_tuple = args_as_string.startswith("(") + else: + args_as_string = item[index + 1 :].strip() + args = ast.literal_eval(args_as_string) + is_tuple = args_as_string.startswith("(") + method_or_attribute = item[:index].strip() + result[method_or_attribute] = self._parse_arguments(args, is_tuple) + return result + + def _parse_arguments(self, argument, is_tuple=False): + if argument == "": + return [] + if is_tuple: + return [argument] + if not is_tuple and isinstance(argument, tuple): + return list(argument) + return [argument] + def _parse(self, options): result = [] for item in self._split(options): From da2004f83ad67f94d2f5f50c7608b6ab694c718a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Feb 2024 10:07:26 -0500 Subject: [PATCH 218/407] Starting to bring service class down into driver creation for various browsers The is just an in ititial commit with some changes which bring the service class down to the point where we create/instantiate the webdrivers for the for the various browsers. Still need some work to actually use what the user provides and to test this code. --- src/SeleniumLibrary/keywords/browsermanagement.py | 10 ++++++++++ .../keywords/webdrivertools/webdrivertools.py | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index 665ffe89b..57c15087b 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -68,6 +68,7 @@ def open_browser( options: Any = None, service_log_path: Optional[str] = None, executable_path: Optional[str] = None, + service: Any = None, ) -> str: """Opens a new browser instance to the optional ``url``. @@ -279,6 +280,10 @@ def open_browser( return index if desired_capabilities: self.warn("desired_capabilities has been deprecated and removed. Please use options to configure browsers as per documentation.") + if service_log_path: + self.warn("service_log_path is being deprecated. Please use service to configure log_output or equivalent service attribute.") + if executable_path: + self.warn("exexcutable_path is being deprecated. Please use service to configure the driver's executable_path as per documentation.") return self._make_new_browser( url, browser, @@ -289,6 +294,7 @@ def open_browser( options, service_log_path, executable_path, + service, ) def _make_new_browser( @@ -302,6 +308,7 @@ def _make_new_browser( options=None, service_log_path=None, executable_path=None, + service=None, ): if remote_url: self.info( @@ -318,6 +325,7 @@ def _make_new_browser( options, service_log_path, executable_path, + service, ) driver = self._wrap_event_firing_webdriver(driver) index = self.ctx.register_driver(driver, alias) @@ -763,6 +771,7 @@ def _make_driver( options=None, service_log_path=None, executable_path=None, + service=None, ): driver = self._webdriver_creator.create_driver( browser=browser, @@ -772,6 +781,7 @@ def _make_driver( options=options, service_log_path=service_log_path, executable_path=executable_path, + service=service, ) driver.set_script_timeout(self.ctx.timeout) driver.implicitly_wait(self.ctx.implicit_wait) diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index d4d7da6d2..5ede4da89 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -69,6 +69,7 @@ def create_driver( options=None, service_log_path=None, executable_path=None, + service=None, ): browser = self._normalise_browser_name(browser) creation_method = self._get_creator_method(browser) @@ -89,6 +90,7 @@ def create_driver( options=options, service_log_path=service_log_path, executable_path=executable_path, + service=service, ) return creation_method( desired_capabilities, @@ -96,6 +98,7 @@ def create_driver( options=options, service_log_path=service_log_path, executable_path=executable_path, + service=service, ) def _get_creator_method(self, browser): @@ -148,6 +151,7 @@ def create_chrome( options=None, service_log_path=None, executable_path="chromedriver", + service=None, ): if remote_url: if not options: @@ -169,6 +173,7 @@ def create_headless_chrome( options=None, service_log_path=None, executable_path="chromedriver", + service=None, ): if not options: options = webdriver.ChromeOptions() From 5ca677d047813d686f00b3e09b634ed8c1738a2b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Feb 2024 21:04:22 -0500 Subject: [PATCH 219/407] Completed initial construct of service class Although I have completed the intial implementation of the service class and it's usage, I have discovered unlike the selenium options most if not all of the attributes must be set on the instantiate of the class. So need to rework the parsing (should check signature instead of attributes) and then construct the class with these parameters. --- atest/acceptance/browser_service.robot | 2 +- .../keywords/webdrivertools/webdrivertools.py | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/atest/acceptance/browser_service.robot b/atest/acceptance/browser_service.robot index 716973c31..bdce3f4e8 100644 --- a/atest/acceptance/browser_service.robot +++ b/atest/acceptance/browser_service.robot @@ -6,4 +6,4 @@ Documentation These tests check the service argument of Open Browser. *** Test Cases *** Browser With Selenium Service As String Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} - ... service=port=1234; executable_path = '/path/to/driver/executable' + ... service=port=1234; executable_path='/path/to/driver/executable' diff --git a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py index 5ede4da89..573ff32d1 100644 --- a/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py +++ b/src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py @@ -58,7 +58,7 @@ class WebDriverCreator: def __init__(self, log_dir): self.log_dir = log_dir self.selenium_options = SeleniumOptions() - #self.selenium_service = SeleniumService() + self.selenium_service = SeleniumService() def create_driver( self, @@ -76,6 +76,7 @@ def create_driver( desired_capabilities = self._parse_capabilities(desired_capabilities, browser) service_log_path = self._get_log_path(service_log_path) options = self.selenium_options.create(self.browser_names.get(browser), options) + service = self.selenium_service.create(self.browser_names.get(browser), service) if service_log_path: logger.info(f"Browser driver log file created to: {service_log_path}") self._create_directory(service_log_path) @@ -160,7 +161,8 @@ def create_chrome( if not executable_path: executable_path = self._get_executable_path(webdriver.chrome.service.Service) log_method = self._get_log_method(ChromeService, service_log_path) - service = ChromeService(executable_path=executable_path, **log_method) + if not service: + service = ChromeService(executable_path=executable_path, **log_method) return webdriver.Chrome( options=options, service=service, @@ -573,7 +575,7 @@ def _split(self, service): if toknum == token.OP and tokval == ";": split_service.append(service[start_position : tokpos[1]].strip()) start_position = tokpos[1] + 1 - split_service.append(options[start_position:]) + split_service.append(service[start_position:]) return split_service class SeleniumOptions: From 51ce574c8889ab4c6cf5e95ffadb11ae852b7f61 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 6 Mar 2024 20:43:18 -0500 Subject: [PATCH 220/407] Added Yuri and Lisa as Authors --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d1285e143..e2a6492ff 100755 --- a/setup.py +++ b/setup.py @@ -33,7 +33,7 @@ version = VERSION, description = 'Web testing library for Robot Framework', long_description = DESCRIPTION, - author = 'Ed Manlove', + author = 'Ed Manlove, Yuri Verweij, Lisa Crispin', author_email = 'emanlove@verizon.net', url = 'https://github.com/robotframework/SeleniumLibrary', license = 'Apache License 2.0', From fcaf8c2f7305a737c1c1f5a27c906cf6005b53ba Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Thu, 7 Mar 2024 14:33:03 +0100 Subject: [PATCH 221/407] Updated versions, added firefox installation and enabled the tests for firefox --- .github/workflows/CI.yml | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 37dc72c83..f94cc0ded 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,8 +10,8 @@ jobs: strategy: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 - rf-version: [5.0.1, 6.1.1, 7.0b1] - selenium-version: [4.14.0, 4.15.2, 4.16.0] + rf-version: [5.0.1, 6.1.1, 7.0] + selenium-version: [4.14.0, 4.15.2, 4.16.0, 4.17.0] steps: - uses: actions/checkout@v3 @@ -27,6 +27,14 @@ jobs: - run: | echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} ${{ steps.setup-chrome.outputs.chrome-path }} --version + - name: Setup firefox + id: setup-firefox + uses: browser-actions/setup-firefox@v1 + with: + firefox-version: latest + - run: | + echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }} + ${{ steps.setup-firefox.outputs.firefox-path }} --version - name: Start xvfb run: | export DISPLAY=:99.0 @@ -62,23 +70,22 @@ jobs: # Temporarily ignoring pypy execution - name: Run tests with headless Chrome and with PyPy - if: matrix.python-version == 'pypy-3.9' + if: startsWith( matrix.python-version, 'pypy') == true run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome - name: Run tests with normal Chrome if CPython - if: matrix.python-version != 'pypy-3.9' + if: startsWith( matrix.python-version, 'pypy') == false run: | xvfb-run --auto-servernum python atest/run.py --zip chrome - # Recognize for the moment this will NOT run as we aren't using Python 3.9 - - name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3 - if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3' + - name: Run tests with headless Chrome if CPython + if: startsWith( matrix.python-version, 'pypy') == false run: | - xvfb-run --auto-servernum python atest/run.py --zip headlessfirefox + xvfb-run --auto-servernum python atest/run.py --zip headlesschrome - - name: Run tests with normal Firefox with Python 3.9 and RF != 4.1.3 - if: matrix.python-version == '3.9' && matrix.rf-version != '4.1.3' + - name: Run tests with Firefox if Cpython + if: startsWith( matrix.python-version, 'pypy') == false run: | xvfb-run --auto-servernum python atest/run.py --zip firefox From 6aa401dea3ad71e2370ecafb13647cdddb3d4ff7 Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Thu, 7 Mar 2024 14:56:07 +0100 Subject: [PATCH 222/407] updated actions and filename --- .github/workflows/CI.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index f94cc0ded..3a9be4dc6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,12 +11,12 @@ jobs: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [5.0.1, 6.1.1, 7.0] - selenium-version: [4.14.0, 4.15.2, 4.16.0, 4.17.0] + selenium-version: [4.14.0, 4.15.2, 4.16.0] #4.17.0, 4.18.0 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Setup Chrome @@ -99,5 +99,5 @@ jobs: - uses: actions/upload-artifact@v1 if: success() || failure() with: - name: SeleniumLibrary Test results + name: SeleniumLibrary Test results ${{ matrix.python-version }} ${{ matrix.rf-version}} ${{ matrix.selenium-version}} path: atest/zip_results From b0ccfc1baeb062064b955de01e6c76c4ad46994b Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Thu, 7 Mar 2024 15:02:04 +0100 Subject: [PATCH 223/407] updated actions and filename --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 3a9be4dc6..610cb4b95 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -99,5 +99,5 @@ jobs: - uses: actions/upload-artifact@v1 if: success() || failure() with: - name: SeleniumLibrary Test results ${{ matrix.python-version }} ${{ matrix.rf-version}} ${{ matrix.selenium-version}} + name: SeleniumLibrary Test results path: atest/zip_results From a21babb09353f5870370f0be0d86b2097b86b84a Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Thu, 7 Mar 2024 15:22:11 +0100 Subject: [PATCH 224/407] adding browsers to matrix to shorten duration, but increase amount of runs --- .github/workflows/CI.yml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 610cb4b95..277a4110c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,6 +12,7 @@ jobs: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [5.0.1, 6.1.1, 7.0] selenium-version: [4.14.0, 4.15.2, 4.16.0] #4.17.0, 4.18.0 + browser: [firefox, chrome, headlesschrome] steps: - uses: actions/checkout@v4 @@ -74,20 +75,10 @@ jobs: run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome - - name: Run tests with normal Chrome if CPython + - name: Run tests with ${{ matrix.browser }} if CPython if: startsWith( matrix.python-version, 'pypy') == false run: | - xvfb-run --auto-servernum python atest/run.py --zip chrome - - - name: Run tests with headless Chrome if CPython - if: startsWith( matrix.python-version, 'pypy') == false - run: | - xvfb-run --auto-servernum python atest/run.py --zip headlesschrome - - - name: Run tests with Firefox if Cpython - if: startsWith( matrix.python-version, 'pypy') == false - run: | - xvfb-run --auto-servernum python atest/run.py --zip firefox + xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} # - name: Run tests with Selenium Grid # if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.9' From dbab5ada389707ca2b8d883f99806de4b00eb255 Mon Sep 17 00:00:00 2001 From: Yuri Verweij Date: Thu, 7 Mar 2024 15:41:59 +0100 Subject: [PATCH 225/407] fix failing test on firefox (cookie order was different) --- .github/workflows/CI.yml | 2 +- atest/acceptance/keywords/cookies.robot | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 277a4110c..defc9fd99 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,7 +12,7 @@ jobs: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [5.0.1, 6.1.1, 7.0] selenium-version: [4.14.0, 4.15.2, 4.16.0] #4.17.0, 4.18.0 - browser: [firefox, chrome, headlesschrome] + browser: [firefox, chrome, headlesschrome] #edge steps: - uses: actions/checkout@v4 diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 23e2d6e05..81e22c453 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -49,8 +49,9 @@ Add Cookie When Expiry Is Human Readable Data&Time Delete Cookie [Tags] Known Issue Safari Delete Cookie test - ${cookies} = Get Cookies - Should Be Equal ${cookies} far_future=timemachine; another=value + ${cookies} = Get Cookies as_dict=True + ${expected_cookies} Create Dictionary far_future=timemachine another=value + Dictionaries Should Be Equal ${cookies} ${expected_cookies} Non-existent Cookie Run Keyword And Expect Error From 7bdca3c76d2265c3eb2438605b98f95e3865893d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 25 Mar 2024 20:39:18 -0400 Subject: [PATCH 226/407] Added keyword documentation for new `Wait For Expected Condition` keyword --- .../keywords/expectedconditions.py | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/SeleniumLibrary/keywords/expectedconditions.py b/src/SeleniumLibrary/keywords/expectedconditions.py index 17e23bfa4..7b896fd6c 100644 --- a/src/SeleniumLibrary/keywords/expectedconditions.py +++ b/src/SeleniumLibrary/keywords/expectedconditions.py @@ -22,6 +22,32 @@ class ExpectedConditionKeywords(LibraryComponent): @keyword def wait_for_expected_condition(self, condition: string, *args, timeout: Optional[float]=10): + """Waits until ``condition`` is true or ``timeout`` expires. + + The condition must be one of selenium's expected condition which + can be found within the selenium + [https://www.selenium.dev/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.expected_conditions.html#module-selenium.webdriver.support.expected_conditions Python API] + documentation. The expected condition can written as snake_case + (ex title_is) or it can be space delimited (ex Title Is). Some + conditions require additional arguments or ``args`` which should + be passed along after the expected condition. + + Fails if the timeout expires before the condition becomes true. + The default value is 10 seconds. + + Examples: + | `Wait For Expected Condition` | alert_is_present | + | `Wait For Expected Condition` | Title Is | New Title | + + If the expected condition expects a locator then one can pass + as arguments a tuple containing the selenium locator strategies + and the locator. + + Example of expected condition expecting locator: + | ${byElem}= | Evaluate ("id","added_btn") + | `Wait For Expected Condition` | Presence Of Element Located | ${byElem} + """ + condition = self._parse_condition(condition) wait = WebDriverWait(self.driver, timeout, 0.1) try: From ae1fdc8f57386ec3855078ea6152eed33599c5b6 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 30 Mar 2024 13:16:23 -0400 Subject: [PATCH 227/407] Release notes for 6.3.0rc1 --- docs/SeleniumLibrary-6.3.0rc1.rst | 115 ++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 docs/SeleniumLibrary-6.3.0rc1.rst diff --git a/docs/SeleniumLibrary-6.3.0rc1.rst b/docs/SeleniumLibrary-6.3.0rc1.rst new file mode 100644 index 000000000..b94e01b55 --- /dev/null +++ b/docs/SeleniumLibrary-6.3.0rc1.rst @@ -0,0 +1,115 @@ +======================== +SeleniumLibrary 6.3.0rc1 +======================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.3.0rc1 is a new release with +**UPDATE** enhancements and bug fixes. **ADD more intro stuff...** + +All issues targeted for SeleniumLibrary v6.3.0 can be found +from the `issue tracker`_. + +If you have pip_ installed, just run + +:: + + pip install --pre --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.3.0rc1 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.3.0rc1 was released on Saturday March 30, 2024. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.14.0 through 4.19.0 and +Robot Framework 5.0.1, 6.1.1 and 7.0. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.3.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Added ``Minimize Browser Window`` keyword (`#1741`_, rc 1) + New kyeword which minimizes the current browser window. + +- Add keywords to fetch differentiated element Attribute or Property (`#1822`_, rc 1) + The older ``Get Element Attribute`` keyword uses the Selenium getAttribute() method which, + as `this SauceLabs article `_ describes + "did not actually retrieve the Attribute value." Instead it "figured out what the user + was most likely interested in between the Attribute value and the Property values and + returned it." This would mean sometimes it might return an unexpected result. Selenium 4 + introduced newer methods which returns either the attribute or the property as specifically + asked for. + + It is recommend that one transition to these newer ``Get DOM Attribute`` and ``Get Property`` + keywords. + +Acknowledgements +================ + +- `Luciano Martorella `_ contributing the new + minimize keyword (`#1741`_, rc 1) +- `Yuri Verweij `_ and `Lisa Crispin `_ + for reviewing changes and addition to Attribute or Property keywords (`#1822`_, rc 1) +- `Noam Manos `_ for reporting the issues where + the Open Browser 'Options' object has no attribute '' (`#1877`_, rc 1) +- Yuri for helping update the contribution guide (`#1881`_, rc 1) + +and **Yuri Verweij, Lisa Crispin, and Tatu Aalto** for their continued support of the library development. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + - Added + * - `#1741`_ + - enhancement + - high + - Added minimize keyword + - rc�1 + * - `#1822`_ + - enhancement + - high + - Add keywords to fetch differentiated element Attribute or Property + - rc�1 + * - `#1877`_ + - enhancement + - medium + - Open Browser 'Options' object has no attribute '' + - rc�1 + * - `#1881`_ + - --- + - medium + - Update contribution guide + - rc�1 + +Altogether 4 issues. View on the `issue tracker `__. + +.. _#1741: https://github.com/robotframework/SeleniumLibrary/issues/1741 +.. _#1822: https://github.com/robotframework/SeleniumLibrary/issues/1822 +.. _#1877: https://github.com/robotframework/SeleniumLibrary/issues/1877 +.. _#1881: https://github.com/robotframework/SeleniumLibrary/issues/1881 From 8689a18f512b5790751f66030869de422b1f8762 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 30 Mar 2024 13:16:57 -0400 Subject: [PATCH 228/407] Updated version to 6.3.0rc1 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 2788d2c60..02509c02e 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -51,7 +51,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.2.1.dev1" +__version__ = "6.3.0rc1" class SeleniumLibrary(DynamicCore): From 5d09392776f2369b5ce797874d588b41aba79128 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 30 Mar 2024 13:17:46 -0400 Subject: [PATCH 229/407] Generate stub file for 6.3.0rc1 --- src/SeleniumLibrary/__init__.pyi | 249 ++++++++++++++++--------------- 1 file changed, 126 insertions(+), 123 deletions(-) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index 3f651199a..f7b14b840 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -6,78 +6,80 @@ from selenium.webdriver.remote.webdriver import WebDriver from selenium.webdriver.remote.webelement import WebElement class SeleniumLibrary: - def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional[str]] = None, plugins: Optional[Optional[str]] = None, event_firing_webdriver: Optional[Optional[str]] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25)): ... - def add_cookie(self, name: str, value: str, path: Optional[Optional[str]] = None, domain: Optional[Optional[str]] = None, secure: Optional[Optional[bool]] = None, expiry: Optional[Optional[str]] = None): ... + def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional] = None, plugins: Optional[Optional] = None, event_firing_webdriver: Optional[Optional] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25)): ... + def add_cookie(self, name: str, value: str, path: Optional[Optional] = None, domain: Optional[Optional] = None, secure: Optional[Optional] = None, expiry: Optional[Optional] = None): ... def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... - def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... - def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... - def assign_id_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], id: str): ... - def capture_element_screenshot(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], filename: str = 'selenium-element-screenshot-{index}.png'): ... + def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def assign_id_to_element(self, locator: Union, id: str): ... + def capture_element_screenshot(self, locator: Union, filename: str = 'selenium-element-screenshot-{index}.png'): ... def capture_page_screenshot(self, filename: str = 'selenium-screenshot-{index}.png'): ... - def checkbox_should_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def checkbox_should_not_be_selected(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def choose_file(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], file_path: str): ... - def clear_element_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def click_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... - def click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False, action_chain: bool = False): ... - def click_element_at_coordinates(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... - def click_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... - def click_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], modifier: Union[bool, str] = False): ... + def checkbox_should_be_selected(self, locator: Union): ... + def checkbox_should_not_be_selected(self, locator: Union): ... + def choose_file(self, locator: Union, file_path: str): ... + def clear_element_text(self, locator: Union): ... + def click_button(self, locator: Union, modifier: Union = False): ... + def click_element(self, locator: Union, modifier: Union = False, action_chain: bool = False): ... + def click_element_at_coordinates(self, locator: Union, xoffset: int, yoffset: int): ... + def click_image(self, locator: Union, modifier: Union = False): ... + def click_link(self, locator: Union, modifier: Union = False): ... def close_all_browsers(self): ... def close_browser(self): ... def close_window(self): ... - def cover_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def create_webdriver(self, driver_name: str, alias: Optional[Optional[str]] = None, kwargs: Optional[Optional[dict]] = None, **init_kwargs): ... + def cover_element(self, locator: Union): ... + def create_webdriver(self, driver_name: str, alias: Optional[Optional] = None, kwargs: Optional[Optional] = None, **init_kwargs): ... def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... def delete_all_cookies(self): ... def delete_cookie(self, name): ... - def double_click_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def drag_and_drop(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], target: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def drag_and_drop_by_offset(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], xoffset: int, yoffset: int): ... - def element_attribute_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str, expected: Optional[str], message: Optional[Optional[str]] = None): ... - def element_should_be_disabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_focused(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def element_should_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None): ... - def element_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... - def element_should_not_be_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None): ... - def element_should_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... - def element_text_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... - def element_text_should_not_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], not_expected: Optional[str], message: Optional[Optional[str]] = None, ignore_case: bool = False): ... + def double_click_element(self, locator: Union): ... + def drag_and_drop(self, locator: Union, target: Union): ... + def drag_and_drop_by_offset(self, locator: Union, xoffset: int, yoffset: int): ... + def element_attribute_value_should_be(self, locator: Union, attribute: str, expected: Optional, message: Optional[Optional] = None): ... + def element_should_be_disabled(self, locator: Union): ... + def element_should_be_enabled(self, locator: Union): ... + def element_should_be_focused(self, locator: Union): ... + def element_should_be_visible(self, locator: Union, message: Optional[Optional] = None): ... + def element_should_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_should_not_be_visible(self, locator: Union, message: Optional[Optional] = None): ... + def element_should_not_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_text_should_be(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_text_should_not_be(self, locator: Union, not_expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... def execute_async_javascript(self, *code: Any): ... def execute_javascript(self, *code: Any): ... - def frame_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, loglevel: str = 'TRACE'): ... + def frame_should_contain(self, locator: Union, text: str, loglevel: str = 'TRACE'): ... def get_action_chain_delay(self): ... def get_all_links(self): ... def get_browser_aliases(self): ... def get_browser_ids(self): ... def get_cookie(self, name: str): ... def get_cookies(self, as_dict: bool = False): ... - def get_element_attribute(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], attribute: str): ... - def get_element_count(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_element_size(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_horizontal_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_list_items(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], values: bool = False): ... + def get_dom_attribute(self, locator: Union, attribute: str): ... + def get_element_attribute(self, locator: Union, attribute: str): ... + def get_element_count(self, locator: Union): ... + def get_element_size(self, locator: Union): ... + def get_horizontal_position(self, locator: Union): ... + def get_list_items(self, locator: Union, values: bool = False): ... def get_location(self): ... def get_locations(self, browser: str = 'CURRENT'): ... - def get_selected_list_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_labels(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_selected_list_values(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_property(self, locator: Union, property: str): ... + def get_selected_list_label(self, locator: Union): ... + def get_selected_list_labels(self, locator: Union): ... + def get_selected_list_value(self, locator: Union): ... + def get_selected_list_values(self, locator: Union): ... def get_selenium_implicit_wait(self): ... def get_selenium_page_load_timeout(self): ... def get_selenium_speed(self): ... def get_selenium_timeout(self): ... def get_session_id(self): ... def get_source(self): ... - def get_table_cell(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, loglevel: str = 'TRACE'): ... - def get_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_table_cell(self, locator: Union, row: int, column: int, loglevel: str = 'TRACE'): ... + def get_text(self, locator: Union): ... def get_title(self): ... - def get_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_vertical_position(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_webelement(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def get_webelements(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def get_value(self, locator: Union): ... + def get_vertical_position(self, locator: Union): ... + def get_webelement(self, locator: Union): ... + def get_webelements(self, locator: Union): ... def get_window_handles(self, browser: str = 'CURRENT'): ... def get_window_identifiers(self, browser: str = 'CURRENT'): ... def get_window_names(self, browser: str = 'CURRENT'): ... @@ -86,104 +88,105 @@ class SeleniumLibrary: def get_window_titles(self, browser: str = 'CURRENT'): ... def go_back(self): ... def go_to(self, url): ... - def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... - def input_password(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], password: str, clear: bool = True): ... - def input_text(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], text: str, clear: bool = True): ... - def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Optional[datetime.timedelta]] = None): ... - def list_selection_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *expected: str): ... - def list_should_have_no_selections(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def location_should_be(self, url: str, message: Optional[Optional[str]] = None): ... - def location_should_contain(self, expected: str, message: Optional[Optional[str]] = None): ... + def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def input_password(self, locator: Union, password: str, clear: bool = True): ... + def input_text(self, locator: Union, text: str, clear: bool = True): ... + def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def list_selection_should_be(self, locator: Union, *expected: str): ... + def list_should_have_no_selections(self, locator: Union): ... + def location_should_be(self, url: str, message: Optional[Optional] = None): ... + def location_should_contain(self, expected: str, message: Optional[Optional] = None): ... def log_location(self): ... def log_source(self, loglevel: str = 'INFO'): ... def log_title(self): ... def maximize_browser_window(self): ... - def mouse_down(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_down_on_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_down_on_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_out(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_over(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def mouse_up(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def open_browser(self, url: Optional[Optional[str]] = None, browser: str = 'firefox', alias: Optional[Optional[str]] = None, remote_url: Union[bool, str] = False, desired_capabilities: Optional[Union[dict, None, str]] = None, ff_profile_dir: Optional[Union[selenium.webdriver.firefox.firefox_profile.FirefoxProfile, str, None]] = None, options: Optional[Optional[typing.Any]] = None, service_log_path: Optional[Optional[str]] = None, executable_path: Optional[Optional[str]] = None): ... - def open_context_menu(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def minimize_browser_window(self): ... + def mouse_down(self, locator: Union): ... + def mouse_down_on_image(self, locator: Union): ... + def mouse_down_on_link(self, locator: Union): ... + def mouse_out(self, locator: Union): ... + def mouse_over(self, locator: Union): ... + def mouse_up(self, locator: Union): ... + def open_browser(self, url: Optional[Optional] = None, browser: str = 'firefox', alias: Optional[Optional] = None, remote_url: Union = False, desired_capabilities: Optional[Union] = None, ff_profile_dir: Optional[Union] = None, options: Optional[Any] = None, service_log_path: Optional[Optional] = None, executable_path: Optional[Optional] = None): ... + def open_context_menu(self, locator: Union): ... def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE', limit: Optional[Optional[int]] = None): ... - def page_should_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE', limit: Optional[Optional] = None): ... + def page_should_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... def page_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_not_contain_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_image(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_link(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_radio_button(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_textfield(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], message: Optional[Optional[str]] = None, loglevel: str = 'TRACE'): ... - def press_key(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], key: str): ... - def press_keys(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None, *keys: str): ... + def page_should_not_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def press_key(self, locator: Union, key: str): ... + def press_keys(self, locator: Optional[Union] = None, *keys: str): ... def radio_button_should_be_set_to(self, group_name: str, value: str): ... def radio_button_should_not_be_selected(self, group_name: str): ... - def register_keyword_to_run_on_failure(self, keyword: Optional[str]): ... + def register_keyword_to_run_on_failure(self, keyword: Optional): ... def reload_page(self): ... def remove_location_strategy(self, strategy_name: str): ... - def scroll_element_into_view(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_frame(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def select_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... - def select_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... - def select_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... + def scroll_element_into_view(self, locator: Union): ... + def select_all_from_list(self, locator: Union): ... + def select_checkbox(self, locator: Union): ... + def select_frame(self, locator: Union): ... + def select_from_list_by_index(self, locator: Union, *indexes: str): ... + def select_from_list_by_label(self, locator: Union, *labels: str): ... + def select_from_list_by_value(self, locator: Union, *values: str): ... def select_radio_button(self, group_name: str, value: str): ... def set_action_chain_delay(self, value: timedelta): ... def set_browser_implicit_wait(self, value: timedelta): ... - def set_focus_to_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def set_screenshot_directory(self, path: Optional[str]): ... + def set_focus_to_element(self, locator: Union): ... + def set_screenshot_directory(self, path: Optional): ... def set_selenium_implicit_wait(self, value: timedelta): ... def set_selenium_page_load_timeout(self, value: timedelta): ... def set_selenium_speed(self, value: timedelta): ... def set_selenium_timeout(self, value: timedelta): ... def set_window_position(self, x: int, y: int): ... def set_window_size(self, width: int, height: int, inner: bool = False): ... - def simulate_event(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], event: str): ... - def submit_form(self, locator: Optional[Union[selenium.webdriver.remote.webelement.WebElement, None, str]] = None): ... + def simulate_event(self, locator: Union, event: str): ... + def submit_form(self, locator: Optional[Union] = None): ... def switch_browser(self, index_or_alias: str): ... - def switch_window(self, locator: Union[list, str] = 'MAIN', timeout: Optional[Optional[str]] = None, browser: str = 'CURRENT'): ... - def table_cell_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_column_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_footer_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def table_header_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def table_row_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], row: int, expected: str, loglevel: str = 'TRACE'): ... - def table_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], expected: str, loglevel: str = 'TRACE'): ... - def textarea_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... - def textarea_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... - def textfield_should_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... - def textfield_value_should_be(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], expected: str, message: Optional[Optional[str]] = None): ... - def title_should_be(self, title: str, message: Optional[Optional[str]] = None): ... - def unselect_all_from_list(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... - def unselect_checkbox(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str]): ... + def switch_window(self, locator: Union = MAIN, timeout: Optional[Optional] = None, browser: str = 'CURRENT'): ... + def table_cell_should_contain(self, locator: Union, row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_column_should_contain(self, locator: Union, column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_footer_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def table_header_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def table_row_should_contain(self, locator: Union, row: int, expected: str, loglevel: str = 'TRACE'): ... + def table_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def textarea_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textarea_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textfield_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textfield_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def title_should_be(self, title: str, message: Optional[Optional] = None): ... + def unselect_all_from_list(self, locator: Union): ... + def unselect_checkbox(self, locator: Union): ... def unselect_frame(self): ... - def unselect_from_list_by_index(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *indexes: str): ... - def unselect_from_list_by_label(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *labels: str): ... - def unselect_from_list_by_value(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, str], *values: str): ... - def wait_for_condition(self, condition: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_element_contains(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_element_does_not_contain(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_element_is_enabled(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_element_is_not_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_element_is_visible(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_location_contains(self, expected: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... - def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... - def wait_until_location_is(self, expected: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... - def wait_until_location_is_not(self, location: str, timeout: Optional[Optional[datetime.timedelta]] = None, message: Optional[Optional[str]] = None): ... - def wait_until_page_contains(self, text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_page_contains_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None, limit: Optional[Optional[int]] = None): ... - def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None): ... - def wait_until_page_does_not_contain_element(self, locator: Union[selenium.webdriver.remote.webelement.WebElement, None, str], timeout: Optional[Optional[datetime.timedelta]] = None, error: Optional[Optional[str]] = None, limit: Optional[Optional[int]] = None): ... + def unselect_from_list_by_index(self, locator: Union, *indexes: str): ... + def unselect_from_list_by_label(self, locator: Union, *labels: str): ... + def unselect_from_list_by_value(self, locator: Union, *values: str): ... + def wait_for_condition(self, condition: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_contains(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_does_not_contain(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_enabled(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_not_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_location_contains(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_is(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_is_not(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_page_contains(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_page_contains_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... + def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_page_does_not_contain_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... # methods from library. def add_library_components(self, library_components): ... def get_keyword_names(self): ... From f4f5d5d16517b5ec7f6983bf8340c0a4d2f9b752 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 30 Mar 2024 13:18:49 -0400 Subject: [PATCH 230/407] Generated docs for version 6.3.0rc1 --- docs/SeleniumLibrary-6.3.0rc1.html | 1873 ++++++++++++++++++++++++++++ 1 file changed, 1873 insertions(+) create mode 100644 docs/SeleniumLibrary-6.3.0rc1.html diff --git a/docs/SeleniumLibrary-6.3.0rc1.html b/docs/SeleniumLibrary-6.3.0rc1.html new file mode 100644 index 000000000..6cb9ea9ab --- /dev/null +++ b/docs/SeleniumLibrary-6.3.0rc1.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From fd751bb9153b9c3164fe33f733f6262a9ee97928 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 2 Apr 2024 19:04:10 -0400 Subject: [PATCH 231/407] Fix Firefox unit tests Made unit test compatible to both Selenium v4.17.2 and above as well as v4.16.0 and prior --- .../keywords/test_firefox_profile_parsing.py | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/utest/test/keywords/test_firefox_profile_parsing.py b/utest/test/keywords/test_firefox_profile_parsing.py index 23edcfbf8..3a7e895e2 100644 --- a/utest/test/keywords/test_firefox_profile_parsing.py +++ b/utest/test/keywords/test_firefox_profile_parsing.py @@ -56,8 +56,21 @@ def test_single_method(self): def _parse_result(self, result): to_str = "" - if "key1" in result.default_preferences: - to_str = f"{to_str} key1 {result.default_preferences['key1']}" - if "key2" in result.default_preferences: - to_str = f"{to_str} key2 {result.default_preferences['key2']}" + result_attr = self._get_preferences_attribute(result) + if "key1" in result_attr: + to_str = f"{to_str} key1 {result_attr['key1']}" + if "key2" in result_attr: + to_str = f"{to_str} key2 {result_attr['key2']}" self.results.append(to_str) + + def _get_preferences_attribute(self, result): + # -- temporary fix to transition selenium to v4.17.2 from v4.16.0 and prior + # from inspect import signature + # sig = signature(result) + if hasattr(result,'default_preferences'): + return result.default_preferences + elif hasattr(result,'_desired_preferences'): + return result._desired_preferences + else: + return None + # -- From 204ceda7ad1b766a4b36432b2418f3ca0123c1dc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 2 Apr 2024 19:43:17 -0400 Subject: [PATCH 232/407] Reduced the timeout on the expected timeout within expected conditions The delay for the title change was 600 miliseconds while the timeout was 0.5 seconds. I suspect this gives little time for error. The 600 milisecond timeout was specifically choosen along with the other timeouts in the expected conditions tests such that any combination of delays would be unique. This gives us a framework to test various combinations. So I didn't want to change that. Noting I could simply swap the 600 millisecond test for the 900 millisecond tes .. which might be the best bet. But for now trying to reduce the timeout to 0.3 seconds. --- atest/acceptance/keywords/expected_conditions.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot index afdc1d1e3..4fa40dbfe 100644 --- a/atest/acceptance/keywords/expected_conditions.robot +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -10,10 +10,10 @@ Wait For Expected Conditions One Argument Title Should Be Delayed Wait For Expected Condition Times out within set timeout - [Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.5* + [Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.3* Title Should Be Original Click Element link=delayed change title - Wait For Expected Condition title_is Delayed timeout=0.5 + Wait For Expected Condition title_is Delayed timeout=0.3 Wait For Expected Conditions using WebElement as locator Click Button Change the button state From e1a4f4cd81f9dd881aa19ac2dfa2fdabada80119 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 2 Apr 2024 21:09:03 -0400 Subject: [PATCH 233/407] Expanded selenium versions upto 4.19.0 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index defc9fd99..500d831af 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: matrix: python-version: [3.8, 3.11] # 3.12, pypy-3.9 rf-version: [5.0.1, 6.1.1, 7.0] - selenium-version: [4.14.0, 4.15.2, 4.16.0] #4.17.0, 4.18.0 + selenium-version: [4.14.0, 4.15.2, 4.16.0, 4.17.2, 4.18.1, 4.19.0] browser: [firefox, chrome, headlesschrome] #edge steps: From f17f8f001e46bf87520bc9cc65cf7adbd9de78b2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 5 Apr 2024 09:39:10 -0400 Subject: [PATCH 234/407] Fix acceptance tests --- atest/acceptance/keywords/choose_file.robot | 10 +++++----- atest/acceptance/keywords/click_element.robot | 2 +- atest/acceptance/keywords/page_load_timeout.robot | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/atest/acceptance/keywords/choose_file.robot b/atest/acceptance/keywords/choose_file.robot index 89dc975fd..c03b12751 100644 --- a/atest/acceptance/keywords/choose_file.robot +++ b/atest/acceptance/keywords/choose_file.robot @@ -45,11 +45,11 @@ Choose File With Grid From Library Using SL choose_file method Input Text Should Work Same Way When Not Using Grid [Documentation] - ... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {* - ... LOG 1:9 DEBUG Finished Request - ... LOG 1:10 DEBUG GLOB: POST*/session/*/value*"text": "* - ... LOG 1:13 DEBUG Finished Request - ... LOG 1:14 DEBUG NONE + ... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {* + ... LOG 1:9 DEBUG Finished Request + ... LOG 1:10 DEBUG REGEXP: POST.*/session/.*/value.*['\\\"]text['\\\"]: ['\\\"].* + ... LOG 1:13 DEBUG Finished Request + ... LOG 1:14 DEBUG NONE [Tags] NoGrid [Setup] Touch ${CURDIR}${/}temp.txt Input Text file_to_upload ${CURDIR}${/}temp.txt diff --git a/atest/acceptance/keywords/click_element.robot b/atest/acceptance/keywords/click_element.robot index 4464ad874..d1fd4d4b3 100644 --- a/atest/acceptance/keywords/click_element.robot +++ b/atest/acceptance/keywords/click_element.robot @@ -40,7 +40,7 @@ Click Element Action Chain [Tags] NoGrid [Documentation] ... LOB 1:1 INFO Clicking 'singleClickButton' using an action chain. - ... LOG 1:6 DEBUG GLOB: *actions {"actions": [{* + ... LOG 1:6 DEBUG REGEXP: .*actions {['\\\"]actions['\\\"]: \\\[\\\{.* Click Element singleClickButton action_chain=True Element Text Should Be output single clicked diff --git a/atest/acceptance/keywords/page_load_timeout.robot b/atest/acceptance/keywords/page_load_timeout.robot index 6555267c1..a39df7d50 100644 --- a/atest/acceptance/keywords/page_load_timeout.robot +++ b/atest/acceptance/keywords/page_load_timeout.robot @@ -7,7 +7,7 @@ Test Teardown Close Browser And Reset Page Load Timeout *** Test Cases *** Should Open Browser With Default Page Load Timeout [Documentation] Verify that 'Open Browser' changes the page load timeout. - ... LOG 1.1.1:27 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000} + ... LOG 1.1.1:27 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {['\\\"]pageLoad['\\\"]: 300000} ... LOG 1.1.1:29 DEBUG STARTS: Remote response: status=200 # Note: previous log check was 33 and 37. Recording to see if something is swtiching back and forth Open Browser To Start Page @@ -21,8 +21,8 @@ Should Run Into Timeout Exception Should Set Page Load Timeout For All Opened Browsers [Documentation] One browser is already opened as global suite setup. - ... LOG 2:1 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 5000} - ... LOG 2:5 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 5000} + ... LOG 2:1 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {['\\\"]pageLoad['\\\"]: 5000} + ... LOG 2:5 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {['\\\"]pageLoad['\\\"]: 5000} Open Browser To Start Page Set Selenium Page Load Timeout 5 s From de1a4fbe2b43b454e5b6e2b1578af28825c73518 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 5 Apr 2024 11:20:32 -0400 Subject: [PATCH 235/407] Append results to zip file This may greatly increase the archive file size which we need to simplify our matrix. But at least we should get some more insights into failing tests. --- atest/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/atest/run.py b/atest/run.py index e4059716f..8b5bac4f6 100755 --- a/atest/run.py +++ b/atest/run.py @@ -259,7 +259,7 @@ def create_zip(): zip_name = f"rf-{robot_version}-python-{python_version}.zip" zip_path = os.path.join(ZIP_DIR, zip_name) print("Zip created in: %s" % zip_path) - zip_file = zipfile.ZipFile(zip_path, "w") + zip_file = zipfile.ZipFile(zip_path, "a") for root, dirs, files in os.walk(RESULTS_DIR): for file in files: file_path = os.path.join(root, file) From 8db00db599896d5013316424ebd7c5442407ae92 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 14 Apr 2024 16:39:30 -0500 Subject: [PATCH 236/407] Added selenium version and browser name to archive --- atest/run.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/atest/run.py b/atest/run.py index 8b5bac4f6..2c86cf994 100755 --- a/atest/run.py +++ b/atest/run.py @@ -52,6 +52,7 @@ from robot import rebot_cli from robot import __version__ as robot_version +from selenium import __version__ as selenium_version from robot.utils import is_truthy try: @@ -251,12 +252,12 @@ def process_output(browser): return exit.code -def create_zip(): +def create_zip(browser = None): if os.path.exists(ZIP_DIR): shutil.rmtree(ZIP_DIR) os.mkdir(ZIP_DIR) python_version = platform.python_version() - zip_name = f"rf-{robot_version}-python-{python_version}.zip" + zip_name = f"rf-{robot_version}-python-{python_version}-selenium-{selenium_version}-{browser}.zip" zip_path = os.path.join(ZIP_DIR, zip_name) print("Zip created in: %s" % zip_path) zip_file = zipfile.ZipFile(zip_path, "a") @@ -326,5 +327,5 @@ def create_zip(): interpreter, browser, rf_options, selenium_grid, event_firing_webdriver ) if args.zip: - create_zip() + create_zip(browser) sys.exit(failures) From a0e241d72275ff1e211986b440e14c521fb3d7bb Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 14 Apr 2024 17:05:09 -0500 Subject: [PATCH 237/407] Upload only failed artifacts --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 500d831af..23e3a3e2d 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -88,7 +88,7 @@ jobs: # xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True - uses: actions/upload-artifact@v1 - if: success() || failure() + if: failure() with: name: SeleniumLibrary Test results path: atest/zip_results From cc41bc1b58646d02bd220ad7c33f951bee82a2a0 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 14 Apr 2024 17:43:50 -0500 Subject: [PATCH 238/407] Updated some expected log messages in chrome tests --- .../multiple_browsers_options.robot | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/atest/acceptance/multiple_browsers_options.robot b/atest/acceptance/multiple_browsers_options.robot index 14dfde440..40ce798d7 100644 --- a/atest/acceptance/multiple_browsers_options.robot +++ b/atest/acceptance/multiple_browsers_options.robot @@ -9,32 +9,32 @@ Documentation Creating test which would work on all browser is not possible. *** Test Cases *** Chrome Browser With Selenium Options As String [Documentation] - ... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage") Chrome Browser With Selenium Options As String With Attribute As True [Documentation] - ... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* - ... LOG 1:14 DEBUG GLOB: *"--headless=new"* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]--headless=new['\\\"].* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" ) Chrome Browser With Selenium Options With Complex Object [Tags] NoGrid [Documentation] - ... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:14 DEBUG GLOB: *"mobileEmulation": {"deviceName": "Galaxy S5"* - ... LOG 1:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]mobileEmulation['\\\"]: {['\\\"]deviceName['\\\"]: ['\\\"]Galaxy S5['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_experimental_option( "mobileEmulation" , { 'deviceName' : 'Galaxy S5'}) Chrome Browser With Selenium Options Object [Documentation] - ... LOG 2:14 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 2:14 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?* + ... LOG 2:14 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].* + ... LOG 2:14 DEBUG REGEXP: .*args['\\\"]: \\\[['\\\"]--disable-dev-shm-usage['\\\"].* ${options} = Get Chrome Options Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=${options} @@ -47,8 +47,8 @@ Chrome Browser With Selenium Options Invalid Method Chrome Browser With Selenium Options Argument With Semicolon [Documentation] - ... LOG 1:14 DEBUG GLOB: *"goog:chromeOptions"* - ... LOG 1:14 DEBUG GLOB: *["has;semicolon"* + ... LOG 1:14 DEBUG REGEXP: .*['\\\"]goog:chromeOptions['\\\"].* + ... LOG 1:14 DEBUG REGEXP: .*\\\[['\\\"]has;semicolon['\\\"].* Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} ... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("has;semicolon") From d19773a8f71066eca8fa51b70a1988174bda45ed Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 15 Apr 2024 20:45:00 -0400 Subject: [PATCH 239/407] Removed deprecation of `Press Key` keyword Reverted keyword documentation on `Press Key`. Also added note telling about the differing underlying methods and to try the other if the one used does not work. --- src/SeleniumLibrary/keywords/element.py | 28 ++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 140f527df..d277791f5 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -899,7 +899,26 @@ def simulate_event(self, locator: Union[WebElement, str], event: str): @keyword def press_key(self, locator: Union[WebElement, str], key: str): - """*DEPRECATED in SeleniumLibrary 4.0.* use `Press Keys` instead.""" + """Simulates user pressing key on element identified by ``locator``. + + See the `Locating elements` section for details about the locator + syntax. + + ``key`` is either a single character, a string, or a numerical ASCII + code of the key lead by '\\'. + + Examples: + | `Press Key` | text_field | q | + | `Press Key` | text_field | abcde | + | `Press Key` | login_button | \\13 | # ASCII code for enter key | + + `Press Key` and `Press Keys` differ in the methods to simulate key + presses. `Press Key` uses the WebDriver `SEND_KEYS_TO_ELEMENT` command + using the selenium send_keys method. Although one is not recommended + over the other if `Press Key` does not work we recommend trying + `Press Keys`. + send_ + """ if key.startswith("\\") and len(key) > 1: key = self._map_ascii_key_code_to_key(int(key[1:])) element = self.find_element(locator) @@ -952,6 +971,13 @@ def press_keys(self, locator: Union[WebElement, None, str] = None, *keys: str): | `Press Keys` | text_field | ALT | ARROW_DOWN | # Pressing "ALT" key and then pressing ARROW_DOWN. | | `Press Keys` | text_field | CTRL+c | | # Pressing CTRL key down, sends string "c" and then releases CTRL key. | | `Press Keys` | button | RETURN | | # Pressing "ENTER" key to element. | + + `Press Key` and `Press Keys` differ in the methods to simulate key + presses. `Press Keys` uses the Selenium/WebDriver Actions. + `Press Keys` also has a more extensive syntax for describing keys, + key combinations, and key actions. Although one is not recommended + over the other if `Press Keys` does not work we recommend trying + `Press Key`. """ parsed_keys = self._parse_keys(*keys) if not is_noney(locator): From 6f88848a17f365e1479e3100e120824f28991b60 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 16 Apr 2024 08:17:38 -0400 Subject: [PATCH 240/407] Release notes for 6.3.0rc2 --- docs/SeleniumLibrary-6.3.0rc2.rst | 140 ++++++++++++++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 docs/SeleniumLibrary-6.3.0rc2.rst diff --git a/docs/SeleniumLibrary-6.3.0rc2.rst b/docs/SeleniumLibrary-6.3.0rc2.rst new file mode 100644 index 000000000..19129c90a --- /dev/null +++ b/docs/SeleniumLibrary-6.3.0rc2.rst @@ -0,0 +1,140 @@ +======================== +SeleniumLibrary 6.3.0rc2 +======================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.3.0rc2 is a new release with +enhancements including minimizing browesr window, waiting on expected conditions, +getting element attribute or properties and bug fixes. + +All issues targeted for SeleniumLibrary v6.3.0 can be found +from the `issue tracker`_. + +If you have pip_ installed, just run + +:: + + pip install --pre --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.3.0rc2 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.3.0rc2 was released on Tuesday April 16, 2024. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.14.0 through 4.19.0 and +Robot Framework 5.0.1, 6.1.1 and 7.0. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.3.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Added ``Minimize Browser Window`` keyword (`#1741`_, rc 1) + New keyword which minimizes the current browser window. + +- Add keywords to fetch differentiated element Attribute or Property (`#1822`_, rc 1) + The older ``Get Element Attribute`` keyword uses the Selenium getAttribute() method which, + as `this SauceLabs article `_ describes + "did not actually retrieve the Attribute value." Instead it "figured out what the user + was most likely interested in between the Attribute value and the Property values and + returned it." This would mean sometimes it might return an unexpected result. Selenium 4 + introduced newer methods which returns either the attribute or the property as specifically + asked for. + + It is recommend that one transition to these newer ``Get DOM Attribute`` and ``Get Property`` + keywords. + +- Incorporate the expected conditions of Selenium (`#1827`_, rc 2) + A new keyword that allows for one to wait on an expected condition. + +- Remove deprecation of Press Key keyword (`#1892`_, rc 2) + The Press Keys keyword was introduced to replace Press Key. Press Key in turn was deprecated + but I (Ed Manlove failed to remove). Its been noted that both keywords use different underlying + methods for sending or pressing keys and either one will work in differing situations. So + instead of removing Press Key, it has been reinstated as a library keyword. + +Acknowledgements +================ + +- `Luciano Martorella `_ contributing the new + minimize keyword (`#1741`_, rc 1) +- `Yuri Verweij `_ and `Lisa Crispin `_ + for reviewing changes and addition to Attribute or Property keywords (`#1822`_, rc 1) +- `Noam Manos `_ for reporting the issues where + the Open Browser 'Options' object has no attribute '' (`#1877`_, rc 1) +- Yuri for helping update the contribution guide (`#1881`_, rc 1) +- All those who have commented on the deprecation of Press Key keyword (`#1892`_, rc 2) +- Yuri and Lisa for assisting with the addition of Wait For Expected Condition keyword + and for the Robot Framework Foundation for the ecosystem support (`#1827`_, rc 2) + +and **Yuri Verweij, Lisa Crispin, and Tatu Aalto** for their continued support of the library development. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + - Added + * - `#1741`_ + - enhancement + - high + - Added minimize keyword + - rc�1 + * - `#1822`_ + - enhancement + - high + - Add keywords to fetch differentiated element Attribute or Property + - rc�1 + * - `#1827`_ + - enhancement + - high + - Incorporate the expected conditions of Selenium + - rc�2 + * - `#1892`_ + - --- + - high + - Remove deprecation of Press Key keyword + - rc�2 + * - `#1877`_ + - enhancement + - medium + - Open Browser 'Options' object has no attribute '' + - rc�1 + * - `#1881`_ + - --- + - medium + - Update contribution guide + - rc�1 + +Altogether 6 issues. View on the `issue tracker `__. + +.. _#1741: https://github.com/robotframework/SeleniumLibrary/issues/1741 +.. _#1822: https://github.com/robotframework/SeleniumLibrary/issues/1822 +.. _#1827: https://github.com/robotframework/SeleniumLibrary/issues/1827 +.. _#1892: https://github.com/robotframework/SeleniumLibrary/issues/1892 +.. _#1877: https://github.com/robotframework/SeleniumLibrary/issues/1877 +.. _#1881: https://github.com/robotframework/SeleniumLibrary/issues/1881 From 8f2839df0c66c46dd7a3c30162620d12eeeee2d3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 16 Apr 2024 08:18:32 -0400 Subject: [PATCH 241/407] Updated version to 6.3.0rc2 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 7f2d91cb3..ac7d97277 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -52,7 +52,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.3.0rc1" +__version__ = "6.3.0rc2" class SeleniumLibrary(DynamicCore): From 6aa913d9683229c3749ac1f49940b36efb80e542 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 16 Apr 2024 08:19:17 -0400 Subject: [PATCH 242/407] Generate stub file for 6.3.0rc2 --- src/SeleniumLibrary/__init__.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index f7b14b840..5e5ec005e 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -174,6 +174,7 @@ class SeleniumLibrary: def unselect_from_list_by_label(self, locator: Union, *labels: str): ... def unselect_from_list_by_value(self, locator: Union, *values: str): ... def wait_for_condition(self, condition: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_for_expected_condition(self, condition: string, *args, timeout: Optional = 10): ... def wait_until_element_contains(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... def wait_until_element_does_not_contain(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... def wait_until_element_is_enabled(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... From fa73b24e98f54a7158b9bfdbac0042462931c201 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Tue, 16 Apr 2024 08:20:20 -0400 Subject: [PATCH 243/407] Generated docs for version 6.3.0rc2 --- docs/SeleniumLibrary-6.3.0rc2.html | 1873 ++++++++++++++++++++++++++++ 1 file changed, 1873 insertions(+) create mode 100644 docs/SeleniumLibrary-6.3.0rc2.html diff --git a/docs/SeleniumLibrary-6.3.0rc2.html b/docs/SeleniumLibrary-6.3.0rc2.html new file mode 100644 index 000000000..d59113795 --- /dev/null +++ b/docs/SeleniumLibrary-6.3.0rc2.html @@ -0,0 +1,1873 @@ + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From cbc6fad5ed0077ee71fb78f783b6cb7fadd3f82b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 19 Apr 2024 09:14:05 -0400 Subject: [PATCH 244/407] Release notes for 6.3.0 --- docs/SeleniumLibrary-6.3.0.rst | 136 +++++++++++++++++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 docs/SeleniumLibrary-6.3.0.rst diff --git a/docs/SeleniumLibrary-6.3.0.rst b/docs/SeleniumLibrary-6.3.0.rst new file mode 100644 index 000000000..cfc2a5ae5 --- /dev/null +++ b/docs/SeleniumLibrary-6.3.0.rst @@ -0,0 +1,136 @@ +===================== +SeleniumLibrary 6.3.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.3.0 is a new release with +enhancements including minimizing browesr window, waiting on expected conditions, +getting element attribute or properties and bug fixes. + + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.3.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.3.0 was released on Friday April 19, 2024. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.14.0 through 4.19.0 and +Robot Framework 5.0.1, 6.1.1 and 7.0. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.3.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Added ``Minimize Browser Window`` keyword (`#1741`_) + New keyword which minimizes the current browser window. + +- Add keywords to fetch differentiated element Attribute or Property (`#1822`_) + The older ``Get Element Attribute`` keyword uses the Selenium getAttribute() method which, + as `this SauceLabs article `_ describes + "did not actually retrieve the Attribute value." Instead it "figured out what the user + was most likely interested in between the Attribute value and the Property values and + returned it." This would mean sometimes it might return an unexpected result. Selenium 4 + introduced newer methods which returns either the attribute or the property as specifically + asked for. + + It is recommend that one transition to these newer ``Get DOM Attribute`` and ``Get Property`` + keywords. + +- Incorporate the expected conditions of Selenium (`#1827`_) + A new keyword that allows for one to wait on an expected condition. + +- Remove deprecation of Press Key keyword (`#1892`_) + The Press Keys keyword was introduced to replace Press Key. Press Key in turn was deprecated + but I (Ed Manlove) failed to remove. Its been noted that both keywords use different underlying + methods for sending or pressing keys and either one will work in differing situations. So + instead of removing Press Key, it has been reinstated as a library keyword. + +Acknowledgements +================ + +- `Luciano Martorella `_ contributing the new + minimize keyword (`#1741`_) +- `Yuri Verweij `_ and `Lisa Crispin `_ + for reviewing changes and additions to Attribute or Property keywords (`#1822`_) +- `Noam Manos `_ for reporting the issues where + the Open Browser 'Options' object has no attribute '' (`#1877`_) +- Yuri for helping update the contribution guide (`#1881`_) +- All those who have commented on the deprecation of Press Key keyword (`#1892`_) +- Yuri and Lisa for assisting with the addition of Wait For Expected Condition keyword + and for the Robot Framework Foundation for the ecosystem support (`#1827`_) + +and **Yuri Verweij, Lisa Crispin, and Tatu Aalto** for their continued support of the library development. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1741`_ + - enhancement + - high + - Added minimize keyword + * - `#1822`_ + - enhancement + - high + - Add keywords to fetch differentiated element Attribute or Property + * - `#1827`_ + - enhancement + - high + - Incorporate the expected conditions of Selenium + * - `#1892`_ + - --- + - high + - Remove deprecation of Press Key keyword + * - `#1877`_ + - enhancement + - medium + - Open Browser 'Options' object has no attribute '' + * - `#1881`_ + - --- + - medium + - Update contribution guide + * - `#1841`_ + - --- + - --- + - Update maintainers and email within setup.py + +Altogether 7 issues. View on the `issue tracker `__. + +.. _#1741: https://github.com/robotframework/SeleniumLibrary/issues/1741 +.. _#1822: https://github.com/robotframework/SeleniumLibrary/issues/1822 +.. _#1827: https://github.com/robotframework/SeleniumLibrary/issues/1827 +.. _#1892: https://github.com/robotframework/SeleniumLibrary/issues/1892 +.. _#1877: https://github.com/robotframework/SeleniumLibrary/issues/1877 +.. _#1881: https://github.com/robotframework/SeleniumLibrary/issues/1881 +.. _#1841: https://github.com/robotframework/SeleniumLibrary/issues/1841 From 3e70cceb16c9e7a4d4feccdd4e00dc8babe55fb7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 19 Apr 2024 09:14:53 -0400 Subject: [PATCH 245/407] Updated version to 6.3.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index ac7d97277..24ae59b3f 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -52,7 +52,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.3.0rc2" +__version__ = "6.3.0" class SeleniumLibrary(DynamicCore): From fed527aebd31bdce14bf89a8b49a30adf77e4bff Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 19 Apr 2024 09:16:14 -0400 Subject: [PATCH 246/407] Generated docs for version 6.3.0 --- docs/SeleniumLibrary.html | 51 +++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 15 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 00db82f92..095f88efd 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -7,9 +7,9 @@ - + - - - - - + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From e473514e398f96f8e9a24b09310ab1bb50f2b74b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 19 May 2024 08:43:08 -0400 Subject: [PATCH 281/407] Regenerated project docs --- docs/index.html | 157 +++++++----------------------------------------- 1 file changed, 21 insertions(+), 136 deletions(-) diff --git a/docs/index.html b/docs/index.html index d2d1e7348..947799b22 100644 --- a/docs/index.html +++ b/docs/index.html @@ -2,7 +2,7 @@ - + SeleniumLibrary @@ -13,7 +13,7 @@

SeleniumLibrary

@@ -31,17 +29,25 @@

Introduction<

SeleniumLibrary is a web testing library for Robot Framework that utilizes the Selenium tool internally. The project is hosted on GitHub and downloads can be found from PyPI.

-

SeleniumLibrary works with Selenium 3 and 4. It supports Python 3.6 or +

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 or newer. In addition to the normal Python interpreter, it works also with PyPy.

-

SeleniumLibrary is based on the old SeleniumLibrary that was forked to -Selenium2Library and then later renamed back to SeleniumLibrary. -See the Versions and History sections below for more information about -different versions and the overall project history.

-https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version -https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg -https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg -https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master +

SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to +Selenium2Library and then later renamed back to SeleniumLibrary. +See the VERSIONS.rst for more information about different versions and the +overall project history.

+ +https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version + + +https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg + + +https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg + + +https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master +

Keyword Documentation

@@ -56,18 +62,8 @@

Installation< versions, but you still need to install browser drivers separately. The --upgrade option can be omitted when installing the library for the first time.

-

Those migrating from Selenium2Library can install SeleniumLibrary so that -it is exposed also as Selenium2Library:

-
pip install --upgrade robotframework-selenium2library
-

The above command installs the normal SeleniumLibrary as well as a new -Selenium2Library version that is just a thin wrapper to SeleniumLibrary. -That allows importing Selenium2Library in tests while migrating to -SeleniumLibrary.

-

To install the last legacy Selenium2Library version, use this command instead:

-
pip install robotframework-selenium2library==1.8.0
-

With recent versions of pip it is possible to install directly from the -GitHub repository. To install latest source from the master branch, use -this command:

+

It is possible to install directly from the GitHub repository. To install +latest source from the master branch, use this command:

pip install git+https://github.com/robotframework/SeleniumLibrary.git

Please note that installation will take some time, because pip will clone the SeleniumLibrary project to a temporary directory and then @@ -175,7 +171,6 @@

Community

If the provided documentation is not enough, there are various community channels available:

-
-

Versions

-

SeleniumLibrary has over the years lived under SeleniumLibrary and -Selenium2Library names and different library versions have supported -different Selenium and Python versions. This is summarized in the table -below and the History section afterwards explains the project history -a bit more.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Project

Selenium Version

Python Version

Comment

SeleniumLibrary 2.9.2 and earlier

Selenium 1 and 2

Python 2.5-2.7

The original SeleniumLibrary using Selenium RC API.

Selenium2Library 1.8.0 and earlier

Selenium 2 and 3

Python 2.6-2.7

Fork of SeleniumLibrary using Selenium WebDriver API.

SeleniumLibrary 3.0 and 3.1

Selenium 2 and 3

Python 2.7 and 3.3+

Selenium2Library renamed and with Python 3 support and new architecture.

SeleniumLibrary 3.2

Selenium 3

Python 2.7 and 3.4+

Drops Selenium 2 support.

SeleniumLibrary 4.0

Selenium 3

Python 2.7 and 3.4+

Plugin API and support for event friging webdriver.

SeleniumLibrary 4.1

Selenium 3

Python 2.7 and 3.5+

Drops Python 3.4 support.

SeleniumLibrary 4.2

Selenium 3

Python 2.7 and 3.5+

Supports only Selenium 3.141.0 or newer.

SeleniumLibrary 4.4

Selenium 3 and 4

Python 2.7 and 3.6+

New PythonLibCore and dropped Python 3.5 support.

SeleniumLibrary 5.0

Selenium 3 and 4

Python 3.6+

Python 2 and Jython support is dropped.

SeleniumLibrary 5.1

Selenium 3 and 4

Python 3.6+

Robot Framework 3.1 support is dropped.

Selenium2Library 3.0

Depends on SeleniumLibrary

Depends on SeleniumLibrary

Thin wrapper for SeleniumLibrary 3.0 to ease transition.

-
-
-

History

-

SeleniumLibrary originally used the Selenium Remote Controller (RC) API. -When Selenium 2 was introduced with the new but backwards incompatible -WebDriver API, SeleniumLibrary kept using Selenium RC and separate -Selenium2Library using WebDriver was forked. These projects contained -mostly the same keywords and in most cases Selenium2Library was a drop-in -replacement for SeleniumLibrary.

-

Over the years development of the old SeleniumLibrary stopped and also -the Selenium RC API it used was deprecated. Selenium2Library was developed -further and replaced the old library as the de facto web testing library -for Robot Framework.

-

When Selenium 3 was released in 2016, it was otherwise backwards compatible -with Selenium 2, but the deprecated Selenium RC API was removed. This had two -important effects:

-
    -
  • The old SeleniumLibrary could not anymore be used with new Selenium versions. -This project was pretty much dead.

  • -
  • Selenium2Library was badly named as it supported Selenium 3 just fine. -This project needed a new name.

  • -
-

At the same time when Selenium 3 was released, Selenium2Library was going -through larger architecture changes in order to ease future maintenance and -to make adding Python 3 support easier. With all these big internal and -external changes, it made sense to rename Selenium2Library back to -SeleniumLibrary. This decision basically meant following changes:

-
    -
  • Create separate repository for the old SeleniumLibrary to preserve -its history since Selenium2Library was forked.

  • -
  • Rename Selenium2Library project and the library itself to SeleniumLibrary.

  • -
  • Add new Selenium2Library project to ease transitioning from Selenium2Library -to SeleniumLibrary.

  • -
-

Going forward, all new development will happen in the new SeleniumLibrary -project.

-
From 998dda0d0f09a312dd87804bd01814d43a4da8a6 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 22 May 2024 08:15:23 -0400 Subject: [PATCH 282/407] Release notes for 6.4.0 --- docs/SeleniumLibrary-6.4.0.rst | 127 +++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 docs/SeleniumLibrary-6.4.0.rst diff --git a/docs/SeleniumLibrary-6.4.0.rst b/docs/SeleniumLibrary-6.4.0.rst new file mode 100644 index 000000000..c03214efb --- /dev/null +++ b/docs/SeleniumLibrary-6.4.0.rst @@ -0,0 +1,127 @@ +===================== +SeleniumLibrary 6.4.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.4.0 is a new release with +enhancements around driver configuration and logging, printing pages as pdf, +and some bug fixes. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.4.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.4.0 was released on Wednesday May 22, 2024. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.16.0 through 4.21.0 and +Robot Framework 5.0.1, 6.1.1 and 7.0. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.4.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Add new selenium 4 print page as PDF functionality (`#1824`_) + The print page as pdf functionality within Selenium 4 has been added into SeleniumLibrary + with a new keyword. See the keyword documentation for usage. +- Add driver Service Class into Open Browser (`#1900`_) + Selenium has shifted from a couple arguments for configuring the driver settings into the new + Service class. As with the options argument these changes allows for service class to be set + using a simlar string format. More information can be found in the `Open Browser` keyword + documentation and newly rearranged Introduction. +- Add warning about frame deselection when using `Page Should Contain` keyword. (`#1894`_) + In searching through the page, the `Page Should Contain` keyword will select and search + through frames. Thus it silently changes the frame context. Added warning within the keyword + documentation noting as such. +- Wrong Type Hint on some keywords. (`locator: Union[WebElement, None, str]`) (`#1880`_) + Several type hints on locator arguments denoted the argument allowed for none when indeed + they did not. This corrects those type hints. + +Deprecated features +=================== + +- Start Deprecation and Removal of Selenium2Library (deep) references/package (`#1826`_) + Removed references and instructions regarding Selenium2Library; moving some to an archived + VERSIONS.rst top level documentation. + +Acknowledgements +================ + +- We would like to thank `René Rohner `_ for discovering the + incorrect type hints on some keywords. (`locator: Union[WebElement, None, str]`) (`#1880`_) +- `SamMaksymyshyn `_, `Yuri Verweij `_ + and `Lisa Crispin `_ for helping to model and design the new + print page as PDF functionality (`#1824`_) +- `Tatu Aalto `_ for modeling and reviewing the added driver Service Class into Open Browser (`#1900`_) +- I want to thank `Eman `_ for pointing out that I wanted + deprecate and not devalue the Selenium2Library. I also want to thank everyone in their persistence + to push me to start deprecating the Selenium2Library package (`#1826`_) +- .. and Tatu for fixing the internal test run on Mac (`#1899`_) + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1880`_ + - bug + - high + - Wrong Type Hint on some keywords. (`locator: Union[WebElement, None, str]`) + * - `#1824`_ + - enhancement + - high + - Add new selenium 4 print page as PDF functionality + * - `#1894`_ + - enhancement + - high + - Add warning about frame deselection when using `Page Should Contain` keyword. + * - `#1900`_ + - enhancement + - high + - Add driver Service Class into Open Browser + * - `#1826`_ + - --- + - high + - Start Deprecation and Removal of Selenium2Library (deep) references/package + * - `#1899`_ + - --- + - --- + - Make test run on Mac + +Altogether 6 issues. View on the `issue tracker `__. + +.. _#1880: https://github.com/robotframework/SeleniumLibrary/issues/1880 +.. _#1824: https://github.com/robotframework/SeleniumLibrary/issues/1824 +.. _#1894: https://github.com/robotframework/SeleniumLibrary/issues/1894 +.. _#1900: https://github.com/robotframework/SeleniumLibrary/issues/1900 +.. _#1826: https://github.com/robotframework/SeleniumLibrary/issues/1826 +.. _#1899: https://github.com/robotframework/SeleniumLibrary/issues/1899 From 30a62e559b81df1e63d8848b6721e32e5606320d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 22 May 2024 08:15:48 -0400 Subject: [PATCH 283/407] Updated version to 6.4.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index b473aeebc..06b3d79d3 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -52,7 +52,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.4.0rc1" +__version__ = "6.4.0" class SeleniumLibrary(DynamicCore): From e817786570b02ba4f914cd4cfe1c3152ea678bee Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 22 May 2024 08:16:41 -0400 Subject: [PATCH 284/407] Generated docs for version 6.4.0 --- docs/SeleniumLibrary.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 095f88efd..49a9a757a 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1192,7 +1192,7 @@ jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From ffd78ec9cc05a03bfc9a96b251f8e3d12913d0a9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 10 Jun 2024 20:56:34 -0400 Subject: [PATCH 307/407] Regenerated project docs --- docs/index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/index.html b/docs/index.html index 947799b22..9ecf5168b 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,8 +29,8 @@

Introduction<

SeleniumLibrary is a web testing library for Robot Framework that utilizes the Selenium tool internally. The project is hosted on GitHub and downloads can be found from PyPI.

-

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 or -newer. In addition to the normal Python interpreter, it works also +

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11. +In addition to the normal Python interpreter, it works also with PyPy.

SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to Selenium2Library and then later renamed back to SeleniumLibrary. From 0c19d3cbe5124667385a7ef90ffc01c6cd53b5c5 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Wed, 12 Jun 2024 23:26:29 +0300 Subject: [PATCH 308/407] Fix translation cmd Fixes #1908 --- src/SeleniumLibrary/entry/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SeleniumLibrary/entry/__main__.py b/src/SeleniumLibrary/entry/__main__.py index 21a6896e6..e8b886118 100644 --- a/src/SeleniumLibrary/entry/__main__.py +++ b/src/SeleniumLibrary/entry/__main__.py @@ -49,7 +49,7 @@ def cli(): required=True, ) @click.option( - "--plugin", + "--plugins", help="Same as plugins argument in the library import.", default=None, type=str, @@ -97,7 +97,7 @@ def translation( print("Translation is valid, no updated needed.") else: with filename.open("w") as file: - json.dump(translation, file, indent=4) + json.dump(lib_translation, file, indent=4) print(f"Translation file created in {filename.absolute()}") From 6a620262995663136dc5ec1c6715014fb2408536 Mon Sep 17 00:00:00 2001 From: Tatu Aalto Date: Thu, 13 Jun 2024 22:58:07 +0300 Subject: [PATCH 309/407] Add test for entry point --- atest/acceptance/entry_point.robot | 36 ++++++++++++++++++++++ src/SeleniumLibrary/entry/get_versions.py | 2 +- utest/test/translation/test_translation.py | 1 - 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 atest/acceptance/entry_point.robot diff --git a/atest/acceptance/entry_point.robot b/atest/acceptance/entry_point.robot new file mode 100644 index 000000000..a92c3740a --- /dev/null +++ b/atest/acceptance/entry_point.robot @@ -0,0 +1,36 @@ +*** Settings *** +Library Process + + +*** Test Cases *** +Entry Point Version + ${process} = Run Process + ... python -m SeleniumLibrary.entry --version + ... shell=True + ... cwd=${EXECDIR}/src + Log ${process.stdout} + Log ${process.stderr} + Should Be Equal As Integers ${process.rc} 0 + Should Be Empty ${process.stderr} + Should Contain ${process.stdout} Used Python is: + Should Contain ${process.stdout} Installed selenium version is: + +Entry Point Translation + ${process} = Run Process + ... python -m SeleniumLibrary.entry translation ${OUTPUT_DIR}/translation.json + ... shell=True + ... cwd=${EXECDIR}/src + Log ${process.stdout} + Log ${process.stderr} + Should Be Equal As Integers ${process.rc} 0 + Should Be Empty ${process.stderr} + Should Be Equal ${process.stdout} Translation file created in ${OUTPUT_DIR}/translation.json + ${process} = Run Process + ... python -m SeleniumLibrary.entry translation --compare ${OUTPUT_DIR}/translation.json + ... shell=True + ... cwd=${EXECDIR}/src + Log ${process.stdout} + Log ${process.stderr} + Should Be Equal As Integers ${process.rc} 0 + Should Be Empty ${process.stderr} + Should Be Equal ${process.stdout} Translation is valid, no updated needed. diff --git a/src/SeleniumLibrary/entry/get_versions.py b/src/SeleniumLibrary/entry/get_versions.py index 9c78f7d36..51e68da7a 100644 --- a/src/SeleniumLibrary/entry/get_versions.py +++ b/src/SeleniumLibrary/entry/get_versions.py @@ -45,7 +45,7 @@ def get_version(): ) return ( f"\nUsed Python is: {sys.executable}\n\tVersion: {python_version}\n" - f'Robot Framework version: "{get_rf_version()}\n"' + f'Robot Framework version: "{get_rf_version()}"\n' f"Installed SeleniumLibrary version is: {get_library_version()}\n" f"Installed selenium version is: {__version__}\n" ) diff --git a/utest/test/translation/test_translation.py b/utest/test/translation/test_translation.py index c6726a21a..7d1255241 100644 --- a/utest/test/translation/test_translation.py +++ b/utest/test/translation/test_translation.py @@ -8,7 +8,6 @@ @pytest.fixture() def sl() -> SeleniumLibrary: - d = Path(__file__).parent.parent.absolute() sys.path.append(str(Path(__file__).parent.parent.absolute())) return SeleniumLibrary(language="FI") From e64748741018fac420e594c236d5f4f77b7d0e65 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 15:17:01 -0400 Subject: [PATCH 310/407] Corrected spellings of argument --- src/SeleniumLibrary/__init__.py | 4 ++-- src/SeleniumLibrary/entry/__main__.py | 2 +- .../PluginDocumentation.test_many_plugins.approved.txt | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 7e7d07f39..1db59176c 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -578,8 +578,8 @@ class SeleniumLibrary(DynamicCore): Template translation file, with English language can be created by running: `rfselib translation /path/to/translation.json` command. Command does not provide translations to other languages, it only provides easy way to create full list keywords and their documentation in correct - format. It is also possible to add keywords from library plugins by providing `--plugings` arguments - to command. Example: `rfselib translation --plugings myplugin.SomePlugin /path/to/translation.json` The + format. It is also possible to add keywords from library plugins by providing `--plugins` arguments + to command. Example: `rfselib translation --plugins myplugin.SomePlugin /path/to/translation.json` The generated json file contains `sha256` key, which contains the sha256 sum of the library documentation. The sha256 sum is used by `rfselib translation --compare /path/to/translation.json` command, which compares the translation to the library and prints outs a table which tells if there are changes needed for diff --git a/src/SeleniumLibrary/entry/__main__.py b/src/SeleniumLibrary/entry/__main__.py index e8b886118..47e049233 100644 --- a/src/SeleniumLibrary/entry/__main__.py +++ b/src/SeleniumLibrary/entry/__main__.py @@ -75,7 +75,7 @@ def translation( The filename argument will tell where the default json file is saved. - The --plugin argument will add plugin keywords in addition to the library keywords + The --plugins argument will add plugin keywords in addition to the library keywords into the default translation json file. It is used the same as plugins argument in the library import. diff --git a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt index 9d442556c..447445852 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_many_plugins.approved.txt @@ -517,8 +517,8 @@ translated, instead ``name`` should be kept the same. Template translation file, with English language can be created by running: `rfselib translation /path/to/translation.json` command. Command does not provide translations to other languages, it only provides easy way to create full list keywords and their documentation in correct -format. It is also possible to add keywords from library plugins by providing `--plugings` arguments -to command. Example: `rfselib translation --plugings myplugin.SomePlugin /path/to/translation.json` The +format. It is also possible to add keywords from library plugins by providing `--plugins` arguments +to command. Example: `rfselib translation --plugins myplugin.SomePlugin /path/to/translation.json` The generated json file contains `sha256` key, which contains the sha256 sum of the library documentation. The sha256 sum is used by `rfselib translation --compare /path/to/translation.json` command, which compares the translation to the library and prints outs a table which tells if there are changes needed for From 8ef19268aed13f3f9621e34781453558a8b0d72d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 16:13:32 -0400 Subject: [PATCH 311/407] Release notes for 6.5.0 --- docs/SeleniumLibrary-6.5.0.rst | 98 ++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 docs/SeleniumLibrary-6.5.0.rst diff --git a/docs/SeleniumLibrary-6.5.0.rst b/docs/SeleniumLibrary-6.5.0.rst new file mode 100644 index 000000000..963bd12c6 --- /dev/null +++ b/docs/SeleniumLibrary-6.5.0.rst @@ -0,0 +1,98 @@ +===================== +SeleniumLibrary 6.5.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.5.0 is a new release with +keyword and keyword documentation translations. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.5.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.5.0 was released on Saturday June 15, 2024. SeleniumLibrary supports +Python 3.8 through 3.11, Selenium 4.20.0 and 4.21.0 and +Robot Framework 5.0.1, 6.1.1 and 7.0. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.5.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Keyword and keyword documentation translation (`#1908`_) + This brings in the ability to translate both the keyword names as well as + the keyword documentation. Details on how to create translations can be found + within the keyword documentation. In addition the introduction of the selib tool + allows for further enhancement like ``transform`` which will run Robotidy + alongside a (future) SeleniumLibrary transformer to automatically handle keyword + deprecations. + + A sample translation of the SeleniumLibrary keywords and documentation to Finnish + can be found in + `this marketsquare repo `_. + +Acknowledgements +================ + +I want to thank + +- jeromehuewe for noting the unspecified upper supported Python version (`#1903`_) +- `Tatu Aalto `_ for all the work around bringing in + the translation documentation functionality and the selib tool (`#1907`_) + +I also want to thank `Yuri Verweij `_ for his continued +collaboration on maintaining the SeleniumLibrary. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1908`_ + - bug + - high + - Fix bug in etry point translation creation + * - `#1903`_ + - enhancement + - medium + - Specify supported Python version + * - `#1907`_ + - enhancement + - medium + - Translation documentation + +Altogether 3 issues. View on the `issue tracker `__. + +.. _#1908: https://github.com/robotframework/SeleniumLibrary/issues/1908 +.. _#1903: https://github.com/robotframework/SeleniumLibrary/issues/1903 +.. _#1907: https://github.com/robotframework/SeleniumLibrary/issues/1907 From a30541338e0b973d5d4a1f38dd58402a0a4f4196 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 16:14:08 -0400 Subject: [PATCH 312/407] Updated version to 6.5.0 --- src/SeleniumLibrary/__init__.py | 1736 +++++++++++++++---------------- 1 file changed, 868 insertions(+), 868 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 1db59176c..1b2618941 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -1,868 +1,868 @@ -# Copyright 2008-2011 Nokia Networks -# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors -# Copyright 2016- Robot Framework Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -from collections import namedtuple -from datetime import timedelta -import importlib -from inspect import getdoc, isclass -from pathlib import Path -import pkgutil -from typing import Optional, List, Union - -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 -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement - -from SeleniumLibrary.base import LibraryComponent -from SeleniumLibrary.errors import NoOpenBrowser, PluginError -from SeleniumLibrary.keywords import ( - AlertKeywords, - BrowserManagementKeywords, - CookieKeywords, - ElementKeywords, - ExpectedConditionKeywords, - FormElementKeywords, - FrameKeywords, - JavaScriptKeywords, - RunOnFailureKeywords, - ScreenshotKeywords, - SelectElementKeywords, - TableElementKeywords, - WaitingKeywords, - WebDriverCache, - WindowKeywords, -) -from SeleniumLibrary.keywords.screenshot import EMBED -from SeleniumLibrary.locators import ElementFinder -from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay - - -__version__ = "6.5.0rc1" - - -class SeleniumLibrary(DynamicCore): - """SeleniumLibrary is a web testing library for Robot Framework. - - This document explains how to use keywords provided by SeleniumLibrary. - For information about installation, support, and more, please visit the - [https://github.com/robotframework/SeleniumLibrary|project pages]. - For more information about Robot Framework, see http://robotframework.org. - - SeleniumLibrary uses the Selenium WebDriver modules internally to - control a web browser. See http://seleniumhq.org for more information - about Selenium in general and SeleniumLibrary README.rst - [https://github.com/robotframework/SeleniumLibrary#browser-drivers|Browser drivers chapter] - for more details about WebDriver binary installation. - - %TOC% - - = Locating elements = - - All keywords in SeleniumLibrary that need to interact with an element - on a web page take an argument typically named ``locator`` that specifies - how to find the element. Most often the locator is given as a string - using the locator syntax described below, but `using WebElements` is - possible too. - - == Locator syntax == - - SeleniumLibrary supports finding elements based on different strategies - such as the element id, XPath expressions, or CSS selectors. The strategy - can either be explicitly specified with a prefix or the strategy can be - implicit. - - === Default locator strategy === - - By default, locators are considered to use the keyword specific default - locator strategy. All keywords support finding elements based on ``id`` - and ``name`` attributes, but some keywords support additional attributes - or other values that make sense in their context. For example, `Click - Link` supports the ``href`` attribute and the link text and addition - to the normal ``id`` and ``name``. - - Examples: - - | `Click Element` | example | # Match based on ``id`` or ``name``. | - | `Click Link` | example | # Match also based on link text and ``href``. | - | `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. | - - If a locator accidentally starts with a prefix recognized as `explicit - locator strategy` or `implicit XPath strategy`, it is possible to use - the explicit ``default`` prefix to enable the default strategy. - - Examples: - - | `Click Element` | name:foo | # Find element with name ``foo``. | - | `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. | - | `Click Element` | //foo | # Find element using XPath ``//foo``. | - | `Click Element` | default: //foo | # Use default strategy with value ``//foo``. | - - === Explicit locator strategy === - - The explicit locator strategy is specified with a prefix using either - syntax ``strategy:value`` or ``strategy=value``. The former syntax - is preferred because the latter is identical to Robot Framework's - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-argument-syntax| - named argument syntax] and that can cause problems. Spaces around - the separator are ignored, so ``id:foo``, ``id: foo`` and ``id : foo`` - are all equivalent. - - Locator strategies that are supported by default are listed in the table - below. In addition to them, it is possible to register `custom locators`. - - | = Strategy = | = Match based on = | = Example = | - | id | Element ``id``. | ``id:example`` | - | name | ``name`` attribute. | ``name:example`` | - | identifier | Either ``id`` or ``name``. | ``identifier:example`` | - | class | Element ``class``. | ``class:example`` | - | tag | Tag name. | ``tag:div`` | - | xpath | XPath expression. | ``xpath://div[@id="example"]`` | - | css | CSS selector. | ``css:div#example`` | - | dom | DOM expression. | ``dom:document.images[5]`` | - | link | Exact text a link has. | ``link:The example`` | - | partial link | Partial link text. | ``partial link:he ex`` | - | sizzle | Sizzle selector deprecated. | ``sizzle:div.example`` | - | data | Element ``data-*`` attribute | ``data:id:my_id`` | - | jquery | jQuery expression. | ``jquery:div.example`` | - | default | Keyword specific default behavior. | ``default:example`` | - - See the `Default locator strategy` section below for more information - about how the default strategy works. Using the explicit ``default`` - prefix is only necessary if the locator value itself accidentally - matches some of the explicit strategies. - - Different locator strategies have different pros and cons. Using ids, - either explicitly like ``id:foo`` or by using the `default locator - strategy` simply like ``foo``, is recommended when possible, because - the syntax is simple and locating elements by id is fast for browsers. - If an element does not have an id or the id is not stable, other - solutions need to be used. If an element has a unique tag name or class, - using ``tag``, ``class`` or ``css`` strategy like ``tag:h1``, - ``class:example`` or ``css:h1.example`` is often an easy solution. In - more complex cases using XPath expressions is typically the best - approach. They are very powerful but a downside is that they can also - get complex. - - Examples: - - | `Click Element` | id:foo | # Element with id 'foo'. | - | `Click Element` | css:div#foo h1 | # h1 element under div with id 'foo'. | - | `Click Element` | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. | - | `Click Element` | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. | - - *NOTE:* - - - The ``strategy:value`` syntax is only supported by SeleniumLibrary 3.0 - and newer. - - Using the ``sizzle`` strategy or its alias ``jquery`` requires that - the system under test contains the jQuery library. - - Prior to SeleniumLibrary 3.0, table related keywords only supported - ``xpath``, ``css`` and ``sizzle/jquery`` strategies. - - ``data`` strategy is conveniance locator that will construct xpath from the parameters. - If you have element like `

`, you locate the element via - ``data:automation:automation-id-2``. This feature was added in SeleniumLibrary 5.2.0 - - === Implicit XPath strategy === - - If the locator starts with ``//`` or multiple opening parenthesis in front - of the ``//``, the locator is considered to be an XPath expression. In other - words, using ``//div`` is equivalent to using explicit ``xpath://div`` and - ``((//div))`` is equivalent to using explicit ``xpath:((//div))`` - - Examples: - - | `Click Element` | //div[@id="foo"]//h1 | - | `Click Element` | (//div)[2] | - - The support for the ``(//`` prefix is new in SeleniumLibrary 3.0. - Supporting multiple opening parenthesis is new in SeleniumLibrary 5.0. - - === Chaining locators === - - It is possible chain multiple locators together as single locator. Each chained locator must start with locator - strategy. Chained locators must be separated with single space, two greater than characters and followed with - space. It is also possible mix different locator strategies, example css or xpath. Also a list can also be - used to specify multiple locators. This is useful, is some part of locator would match as the locator separator - but it should not. Or if there is need to existing WebElement as locator. - - Although all locators support chaining, some locator strategies do not abey the chaining. This is because - some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context - and not for the element found be the previous locator. Chaining is supported by locator strategies which - are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery - - Examples: - | `Click Element` | css:.bar >> xpath://a | # To find a link which is present after an element with class "bar" | - - List examples: - | ${locator_list} = | `Create List` | css:div#div_id | xpath://*[text(), " >> "] | - | `Page Should Contain Element` | ${locator_list} | | | - | ${element} = | Get WebElement | xpath://*[text(), " >> "] | | - | ${locator_list} = | `Create List` | css:div#div_id | ${element} | - | `Page Should Contain Element` | ${locator_list} | | | - - Chaining locators in new in SeleniumLibrary 5.0 - - == Using WebElements == - - In addition to specifying a locator as a string, it is possible to use - Selenium's WebElement objects. This requires first getting a WebElement, - for example, by using the `Get WebElement` keyword. - - | ${elem} = | `Get WebElement` | id:example | - | `Click Element` | ${elem} | | - - == Custom locators == - - If more complex lookups are required than what is provided through the - default locators, custom lookup strategies can be created. Using custom - locators is a two part process. First, create a keyword that returns - a WebElement that should be acted on: - - | Custom Locator Strategy | [Arguments] | ${browser} | ${locator} | ${tag} | ${constraints} | - | | ${element}= | Execute Javascript | return window.document.getElementById('${locator}'); | - | | [Return] | ${element} | - - This keyword is a reimplementation of the basic functionality of the - ``id`` locator where ``${browser}`` is a reference to a WebDriver - instance and ``${locator}`` is the name of the locator strategy. To use - this locator, it must first be registered by using the - `Add Location Strategy` keyword: - - | `Add Location Strategy` | custom | Custom Locator Strategy | - - The first argument of `Add Location Strategy` specifies the name of - the strategy and it must be unique. After registering the strategy, - the usage is the same as with other locators: - - | `Click Element` | custom:example | - - See the `Add Location Strategy` keyword for more details. - - = Browser and Window = - - There is different conceptual meaning when SeleniumLibrary talks - about windows or browsers. This chapter explains those differences. - - == Browser == - - When `Open Browser` or `Create WebDriver` keyword is called, it - will create a new Selenium WebDriver instance by using the - [https://www.seleniumhq.org/docs/03_webdriver.jsp|Selenium WebDriver] - API. In SeleniumLibrary terms, a new browser is created. It is - possible to start multiple independent browsers (Selenium Webdriver - instances) at the same time, by calling `Open Browser` or - `Create WebDriver` multiple times. These browsers are usually - independent of each other and do not share data like cookies, - sessions or profiles. Typically when the browser starts, it - creates a single window which is shown to the user. - - == Window == - - Windows are the part of a browser that loads the web site and presents - it to the user. All content of the site is the content of the window. - Windows are children of a browser. In SeleniumLibrary browser is a - synonym for WebDriver instance. One browser may have multiple - windows. Windows can appear as tabs, as separate windows or pop-ups with - different position and size. Windows belonging to the same browser - typically share the sessions detail, like cookies. If there is a - need to separate sessions detail, example login with two different - users, two browsers (Selenium WebDriver instances) must be created. - New windows can be opened example by the application under test or - by example `Execute Javascript` keyword: - - | `Execute Javascript` window.open() # Opens a new window with location about:blank - - The example below opens multiple browsers and windows, - to demonstrate how the different keywords can be used to interact - with browsers, and windows attached to these browsers. - - Structure: - | BrowserA - | Window 1 (location=https://robotframework.org/) - | Window 2 (location=https://robocon.io/) - | Window 3 (location=https://github.com/robotframework/) - | - | BrowserB - | Window 1 (location=https://github.com/) - - Example: - | `Open Browser` | https://robotframework.org | ${BROWSER} | alias=BrowserA | # BrowserA with first window is opened. | - | `Execute Javascript` | window.open() | | | # In BrowserA second window is opened. | - | `Switch Window` | locator=NEW | | | # Switched to second window in BrowserA | - | `Go To` | https://robocon.io | | | # Second window navigates to robocon site. | - | `Execute Javascript` | window.open() | | | # In BrowserA third window is opened. | - | ${handle} | `Switch Window` | locator=NEW | | # Switched to third window in BrowserA | - | `Go To` | https://github.com/robotframework/ | | | # Third windows goes to robot framework github site. | - | `Open Browser` | https://github.com | ${BROWSER} | alias=BrowserB | # BrowserB with first windows is opened. | - | ${location} | `Get Location` | | | # ${location} is: https://www.github.com | - | `Switch Window` | ${handle} | browser=BrowserA | | # BrowserA second windows is selected. | - | ${location} | `Get Location` | | | # ${location} = https://robocon.io/ | - | @{locations 1} | `Get Locations` | | | # By default, lists locations under the currectly active browser (BrowserA). | - | @{locations 2} | `Get Locations` | browser=ALL | | # By using browser=ALL argument keyword list all locations from all browsers. | - - The above example, @{locations 1} contains the following items: - https://robotframework.org/, https://robocon.io/ and - https://github.com/robotframework/'. The @{locations 2} - contains the following items: https://robotframework.org/, - https://robocon.io/, https://github.com/robotframework/' - and 'https://github.com/. - - = Browser and Driver options and service class = - - This section talks about how to configure either the browser or - the driver using the options and service arguments of the `Open - Browser` keyword. - - == Configuring the browser using the Selenium Options == - - As noted within the keyword documentation for `Open Browser`, its - ``options`` argument accepts Selenium options in two different - formats: as a string and as Python object which is an instance of - the Selenium options class. - - === Options string format === - - The string format allows defining Selenium options methods - or attributes and their arguments in Robot Framework test data. - The method and attributes names are case and space sensitive and - must match to the Selenium options methods and attributes names. - When defining a method, it must be defined in a similar way as in - python: method name, opening parenthesis, zero to many arguments - and closing parenthesis. If there is a need to define multiple - arguments for a single method, arguments must be separated with - comma, just like in Python. Example: `add_argument("--headless")` - or `add_experimental_option("key", "value")`. Attributes are - defined in a similar way as in Python: attribute name, equal sign, - and attribute value. Example, `headless=True`. Multiple methods - and attributes must be separated by a semicolon. Example: - `add_argument("--headless");add_argument("--start-maximized")`. - - Arguments allow defining Python data types and arguments are - evaluated by using Python - [https://docs.python.org/3/library/ast.html#ast.literal_eval|ast.literal_eval]. - Strings must be quoted with single or double quotes, example "value" - or 'value'. It is also possible to define other Python builtin - data types, example `True` or `None`, by not using quotes - around the arguments. - - The string format is space friendly. Usually, spaces do not alter - the defining methods or attributes. There are two exceptions. - In some Robot Framework test data formats, two or more spaces are - considered as cell separator and instead of defining a single - argument, two or more arguments may be defined. Spaces in string - arguments are not removed and are left as is. Example - `add_argument ( "--headless" )` is same as - `add_argument("--headless")`. But `add_argument(" --headless ")` is - not same same as `add_argument ( "--headless" )`, because - spaces inside of quotes are not removed. Please note that if - options string contains backslash, example a Windows OS path, - the backslash needs escaping both in Robot Framework data and - in Python side. This means single backslash must be writen using - four backslash characters. Example, Windows path: - "C:\\path\\to\\profile" must be written as - "C:\\\\\\\\path\\\\\\to\\\\\\\\profile". Another way to write - backslash is use Python - [https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals|raw strings] - and example write: r"C:\\\\path\\\\to\\\\profile". - - === Selenium Options as Python class === - - As last format, ``options`` argument also supports receiving - the Selenium options as Python class instance. In this case, the - instance is used as-is and the SeleniumLibrary will not convert - the instance to other formats. - For example, if the following code return value is saved to - `${options}` variable in the Robot Framework data: - | options = webdriver.ChromeOptions() - | options.add_argument('--disable-dev-shm-usage') - | return options - - Then the `${options}` variable can be used as an argument to - ``options``. - - Example the ``options`` argument can be used to launch Chomium-based - applications which utilize the - [https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver|Chromium Embedded Framework] - . To launch Chromium-based application, use ``options`` to define - `binary_location` attribute and use `add_argument` method to define - `remote-debugging-port` port for the application. Once the browser - is opened, the test can interact with the embedded web-content of - the system under test. - - == Configuring the driver using the Service class == - - With the ``service`` argument, one can setup and configure the driver. For example - one can set the driver location and/port or specify the command line arguments. There - are several browser specific attributes related to logging as well. For the various - Service Class attributes refer to - [https://www.selenium.dev/documentation/webdriver/drivers/service/|the Selenium documentation] - . Currently the ``service`` argument only accepts Selenium service in the string format. - - === Service string format === - - The string format allows for defining Selenium service attributes - and their values in the `Open Browser` keyword. The attributes names - are case and space sensitive and must match to the Selenium attributes - names. Attributes are defined in a similar way as in Python: attribute - name, equal sign, and attribute value. Example, `port=1234`. Multiple - attributes must be separated by a semicolon. Example: - `executable_path='/path/to/driver';port=1234`. Don't have duplicate - attributes, like `service_args=['--append-log', '--readable-timestamp']; - service_args=['--log-level=DEBUG']` as the second will override the first. - Instead combine them as in - `service_args=['--append-log', '--readable-timestamp', '--log-level=DEBUG']` - - Arguments allow defining Python data types and arguments are - evaluated by using Python. Strings must be quoted with single - or double quotes, example "value" or 'value' - - = Timeouts, waits, and delays = - - This section discusses different ways how to wait for elements to - appear on web pages and to slow down execution speed otherwise. - It also explains the `time format` that can be used when setting various - timeouts, waits, and delays. - - == Timeout == - - SeleniumLibrary contains various keywords that have an optional - ``timeout`` argument that specifies how long these keywords should - wait for certain events or actions. These keywords include, for example, - ``Wait ...`` keywords and keywords related to alerts. Additionally - `Execute Async Javascript`. Although it does not have ``timeout``, - argument, uses a timeout to define how long asynchronous JavaScript - can run. - - The default timeout these keywords use can be set globally either by - using the `Set Selenium Timeout` keyword or with the ``timeout`` argument - when `importing` the library. If no default timeout is set globally, the - default is 5 seconds. If None is specified for the timeout argument in the - keywords, the default is used. See `time format` below for supported - timeout syntax. - - == Implicit wait == - - Implicit wait specifies the maximum time how long Selenium waits when - searching for elements. It can be set by using the `Set Selenium Implicit - Wait` keyword or with the ``implicit_wait`` argument when `importing` - the library. See [https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp| - Selenium documentation] for more information about this functionality. - - See `time format` below for supported syntax. - - == Page load == - Page load timeout is the amount of time to wait for page load to complete - until a timeout exception is raised. - - The default page load timeout can be set globally - when `importing` the library with the ``page_load_timeout`` argument - or by using the `Set Selenium Page Load Timeout` keyword. - - See `time format` below for supported timeout syntax. - - Support for page load is new in SeleniumLibrary 6.1 - - == Selenium speed == - - Selenium execution speed can be slowed down globally by using `Set - Selenium speed` keyword. This functionality is designed to be used for - demonstrating or debugging purposes. Using it to make sure that elements - appear on a page is not a good idea. The above-explained timeouts - and waits should be used instead. - - See `time format` below for supported syntax. - - == Time format == - - All timeouts and waits can be given as numbers considered seconds - (e.g. ``0.5`` or ``42``) or in Robot Framework's time syntax - (e.g. ``1.5 seconds`` or ``1 min 30 s``). For more information about - the time syntax see the - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format|Robot Framework User Guide]. - - = Run-on-failure functionality = - - SeleniumLibrary has a handy feature that it can automatically execute - a keyword if any of its own keywords fails. By default, it uses the - `Capture Page Screenshot` keyword, but this can be changed either by - using the `Register Keyword To Run On Failure` keyword or with the - ``run_on_failure`` argument when `importing` the library. It is - possible to use any keyword from any imported library or resource file. - - The run-on-failure functionality can be disabled by using a special value - ``NOTHING`` or anything considered false (see `Boolean arguments`) - such as ``NONE``. - - = Boolean arguments = - - Starting from 5.0 SeleniumLibrary relies on Robot Framework to perform the - boolean conversion based on keyword arguments [https://docs.python.org/3/library/typing.html|type hint]. - More details in Robot Framework - [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#supported-conversions|user guide] - - Please note SeleniumLibrary 3 and 4 did have own custom methods to covert - arguments to boolean values. - - = EventFiringWebDriver = - - The SeleniumLibrary offers support for - [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver]. - See the Selenium and SeleniumLibrary - [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#EventFiringWebDriver|EventFiringWebDriver support] - documentation for further details. - - EventFiringWebDriver is new in SeleniumLibrary 4.0 - - = Thread support = - - SeleniumLibrary is not thread-safe. This is mainly due because the underlying - [https://github.com/SeleniumHQ/selenium/wiki/Frequently-Asked-Questions#q-is-webdriver-thread-safe| - Selenium tool is not thread-safe] within one browser/driver instance. - Because of the limitation in the Selenium side, the keywords or the - API provided by the SeleniumLibrary is not thread-safe. - - = Plugins = - - SeleniumLibrary offers plugins as a way to modify and add library keywords and modify some of the internal - functionality without creating a new library or hacking the source code. See - [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#Plugins|plugin API] - documentation for further details. - - Plugin API is new SeleniumLibrary 4.0 - - = Language = - - SeleniumLibrary offers the possibility to translate keyword names and documentation to new language. If language - is defined, SeleniumLibrary will search from - [https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#module-search-path | module search path] - for Python packages starting with `robotframework-seleniumlibrary-translation` by using the - [https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ | Python pluging API]. The Library - is using naming convention to find Python plugins. - - The package must implement a single API call, ``get_language`` without any arguments. The method must return a - dictionary containing two keys: ``language`` and ``path``. The language key value defines which language - the package contains. Also the value should match (case insensitive) the library ``language`` import parameter. - The path parameter value should be full path to the translation file. - - == Translation file == - - The file name or extension is not important, but data must be in [https://www.json.org/json-en.html | json] - format. The keys of json are the methods names, not the keyword names, which implements keywords. Value of - key is json object which contains two keys: ``name`` and ``doc``. The ``name`` key contains the keyword - translated name and `doc` contains translated documentation. Providing doc and name are optional, example - translation json file can only provide translations to keyword names or only to documentation. But it is - always recommended to provide translation to both name and doc. Special key ``__intro__`` is for class level - documentation and ``__init__`` is for init level documentation. These special values ``name`` can not be - translated, instead ``name`` should be kept the same. - - == Generating template translation file == - - Template translation file, with English language can be created by running: - `rfselib translation /path/to/translation.json` command. Command does not provide translations to other - languages, it only provides easy way to create full list keywords and their documentation in correct - format. It is also possible to add keywords from library plugins by providing `--plugins` arguments - to command. Example: `rfselib translation --plugins myplugin.SomePlugin /path/to/translation.json` The - generated json file contains `sha256` key, which contains the sha256 sum of the library documentation. - The sha256 sum is used by `rfselib translation --compare /path/to/translation.json` command, which compares - the translation to the library and prints outs a table which tells if there are changes needed for - the translation file. - - Example project for translation can be found from - [https://github.com/MarketSquare/robotframework-seleniumlibrary-translation-fi | robotframework-seleniumlibrary-translation-fi] - repository. - """ - - ROBOT_LIBRARY_SCOPE = "GLOBAL" - ROBOT_LIBRARY_VERSION = __version__ - - def __init__( - self, - timeout=timedelta(seconds=5), - implicit_wait=timedelta(seconds=0), - run_on_failure="Capture Page Screenshot", - screenshot_root_directory: Optional[str] = None, - plugins: Optional[str] = None, - event_firing_webdriver: Optional[str] = None, - page_load_timeout=timedelta(minutes=5), - action_chain_delay=timedelta(seconds=0.25), - language: Optional[str] = None, - ): - """SeleniumLibrary can be imported with several optional arguments. - - - ``timeout``: - Default value for `timeouts` used with ``Wait ...`` keywords. - - ``implicit_wait``: - Default value for `implicit wait` used when locating elements. - - ``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. - If not given, the directory where the log file is written is used. - - ``plugins``: - Allows extending the SeleniumLibrary with external Python classes. - - ``event_firing_webdriver``: - Class for wrapping Selenium with - [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] - - ``page_load_timeout``: - Default value to wait for page load to complete until a timeout exception is raised. - - ``action_chain_delay``: - Default value for `ActionChains` delay to wait in between actions. - - ``language``: - Defines language which is used to translate keyword names and documentation. - """ - self.timeout = _convert_timeout(timeout) - self.implicit_wait = _convert_timeout(implicit_wait) - self.action_chain_delay = _convert_delay(action_chain_delay) - self.page_load_timeout = _convert_timeout(page_load_timeout) - self.speed = 0.0 - self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( - run_on_failure - ) - self._running_on_failure_keyword = False - self.screenshot_root_directory = screenshot_root_directory - self._resolve_screenshot_root_directory() - self._element_finder = ElementFinder(self) - self._plugin_keywords = [] - libraries = [ - AlertKeywords(self), - BrowserManagementKeywords(self), - CookieKeywords(self), - ElementKeywords(self), - ExpectedConditionKeywords(self), - FormElementKeywords(self), - FrameKeywords(self), - JavaScriptKeywords(self), - RunOnFailureKeywords(self), - ScreenshotKeywords(self), - SelectElementKeywords(self), - TableElementKeywords(self), - WaitingKeywords(self), - WindowKeywords(self), - ] - self.ROBOT_LIBRARY_LISTENER = LibraryListener() - self._running_keyword = None - self.event_firing_webdriver = None - if is_truthy(event_firing_webdriver): - self.event_firing_webdriver = self._parse_listener(event_firing_webdriver) - self._plugins = [] - if is_truthy(plugins): - plugin_libs = self._parse_plugins(plugins) - self._plugins = plugin_libs - libraries = libraries + plugin_libs - self._drivers = WebDriverCache() - translation_file = self._get_translation(language) - DynamicCore.__init__(self, libraries, translation_file) - - def run_keyword(self, name: str, args: tuple, kwargs: dict): - try: - return DynamicCore.run_keyword(self, name, args, kwargs) - except Exception: - self.failure_occurred() - raise - - def get_keyword_tags(self, name: str) -> list: - tags = list(DynamicCore.get_keyword_tags(self, name)) - if name in self._plugin_keywords: - tags.append("plugin") - return tags - - def get_keyword_documentation(self, name: str) -> str: - if name == "__intro__": - return self._get_intro_documentation() - return DynamicCore.get_keyword_documentation(self, name) - - def _parse_plugin_doc(self): - Doc = namedtuple("Doc", "doc, name") - for plugin in self._plugins: - yield Doc( - doc=getdoc(plugin) or "No plugin documentation found.", - name=plugin.__class__.__name__, - ) - - def _get_intro_documentation(self): - intro = DynamicCore.get_keyword_documentation(self, "__intro__") - for plugin_doc in self._parse_plugin_doc(): - intro = f"{intro}\n\n" - intro = f"{intro}= Plugin: {plugin_doc.name} =\n\n" - intro = f"{intro}{plugin_doc.doc}" - return intro - - def register_driver(self, driver: WebDriver, alias: str): - """Add's a `driver` to the library WebDriverCache. - - :param driver: Instance of the Selenium `WebDriver`. - :type driver: selenium.webdriver.remote.webdriver.WebDriver - :param alias: Alias given for this `WebDriver` instance. - :type alias: str - :return: The index of the `WebDriver` instance. - :rtype: int - """ - return self._drivers.register(driver, alias) - - def failure_occurred(self): - """Method that is executed when a SeleniumLibrary keyword fails. - - By default, executes the registered run-on-failure keyword. - Libraries extending SeleniumLibrary can overwrite this hook - method if they want to provide custom functionality instead. - """ - if self._running_on_failure_keyword or not self.run_on_failure_keyword: - return - try: - self._running_on_failure_keyword = True - if self.run_on_failure_keyword.lower() == "capture page screenshot": - self.capture_page_screenshot() - else: - BuiltIn().run_keyword(self.run_on_failure_keyword) - except Exception as err: - logger.warn( - f"Keyword '{self.run_on_failure_keyword}' could not be run on failure: {err}" - ) - finally: - self._running_on_failure_keyword = False - - @property - def driver(self) -> WebDriver: - """Current active driver. - - :rtype: selenium.webdriver.remote.webdriver.WebDriver - :raises SeleniumLibrary.errors.NoOpenBrowser: If browser is not open. - """ - if not self._drivers.current: - raise NoOpenBrowser("No browser is open.") - return self._drivers.current - - def find_element( - self, locator: str, parent: Optional[WebElement] = None - ) -> WebElement: - """Find element matching `locator`. - - :param locator: Locator to use when searching the element. - See library documentation for the supported locator syntax. - :type locator: str or selenium.webdriver.remote.webelement.WebElement - :param parent: Optional parent `WebElememt` to search child elements - from. By default, search starts from the root using `WebDriver`. - :type parent: selenium.webdriver.remote.webelement.WebElement - :return: Found `WebElement`. - :rtype: selenium.webdriver.remote.webelement.WebElement - :raises SeleniumLibrary.errors.ElementNotFound: If element not found. - """ - return self._element_finder.find(locator, parent=parent) - - def find_elements( - self, locator: str, parent: WebElement = None - ) -> List[WebElement]: - """Find all elements matching `locator`. - - :param locator: Locator to use when searching the element. - See library documentation for the supported locator syntax. - :type locator: str or selenium.webdriver.remote.webelement.WebElement - :param parent: Optional parent `WebElememt` to search child elements - from. By default, search starts from the root using `WebDriver`. - :type parent: selenium.webdriver.remote.webelement.WebElement - :return: list of found `WebElement` or e,mpty if elements are not found. - :rtype: list[selenium.webdriver.remote.webelement.WebElement] - """ - return self._element_finder.find( - locator, first_only=False, required=False, parent=parent - ) - - def _parse_plugins(self, plugins): - libraries = [] - importer = Importer("test library") - for parsed_plugin in self._string_to_modules(plugins): - plugin = importer.import_class_or_module(parsed_plugin.module) - if not isclass(plugin): - message = f"Importing test library: '{parsed_plugin.module}' failed." - raise DataError(message) - plugin = plugin(self, *parsed_plugin.args, **parsed_plugin.kw_args) - if not isinstance(plugin, LibraryComponent): - message = ( - "Plugin does not inherit SeleniumLibrary.base.LibraryComponent" - ) - raise PluginError(message) - self._store_plugin_keywords(plugin) - libraries.append(plugin) - return libraries - - def _parse_listener(self, event_firing_webdriver): - listener_module = self._string_to_modules(event_firing_webdriver) - listener_count = len(listener_module) - if listener_count > 1: - message = f"Is is possible import only one listener but there was {listener_count} listeners." - raise ValueError(message) - listener_module = listener_module[0] - importer = Importer("test library") - listener = importer.import_class_or_module(listener_module.module) - if not isclass(listener): - message = f"Importing test Selenium lister class '{listener_module.module}' failed." - raise DataError(message) - return listener - - def _string_to_modules(self, modules): - Module = namedtuple("Module", "module, args, kw_args") - parsed_modules = [] - for module in modules.split(","): - module = module.strip() - module_and_args = module.split(";") - module_name = module_and_args.pop(0) - kw_args = {} - args = [] - for argument in module_and_args: - if "=" in argument: - key, value = argument.split("=") - kw_args[key] = value - else: - args.append(argument) - module = Module(module=module_name, args=args, kw_args=kw_args) - parsed_modules.append(module) - return parsed_modules - - def _store_plugin_keywords(self, plugin): - dynamic_core = DynamicCore([plugin]) - self._plugin_keywords.extend(dynamic_core.get_keyword_names()) - - def _resolve_screenshot_root_directory(self): - screenshot_root_directory = self.screenshot_root_directory - if is_string(screenshot_root_directory): - if screenshot_root_directory.upper() == EMBED: - self.screenshot_root_directory = EMBED - - @staticmethod - def _get_translation(language: Union[str, None]) -> Union[Path, None]: - if not language: - return None - discovered_plugins = { - name: importlib.import_module(name) - for _, name, _ in pkgutil.iter_modules() - if name.startswith("robotframework_seleniumlibrary_translation") - } - for plugin in discovered_plugins.values(): - try: - data = plugin.get_language() - except AttributeError: - continue - if data.get("language", "").lower() == language.lower() and data.get( - "path" - ): - return Path(data.get("path")).absolute() - return None +# Copyright 2008-2011 Nokia Networks +# Copyright 2011-2016 Ryan Tomac, Ed Manlove and contributors +# Copyright 2016- Robot Framework Foundation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +from collections import namedtuple +from datetime import timedelta +import importlib +from inspect import getdoc, isclass +from pathlib import Path +import pkgutil +from typing import Optional, List, Union + +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 +from selenium.webdriver.remote.webdriver import WebDriver +from selenium.webdriver.remote.webelement import WebElement + +from SeleniumLibrary.base import LibraryComponent +from SeleniumLibrary.errors import NoOpenBrowser, PluginError +from SeleniumLibrary.keywords import ( + AlertKeywords, + BrowserManagementKeywords, + CookieKeywords, + ElementKeywords, + ExpectedConditionKeywords, + FormElementKeywords, + FrameKeywords, + JavaScriptKeywords, + RunOnFailureKeywords, + ScreenshotKeywords, + SelectElementKeywords, + TableElementKeywords, + WaitingKeywords, + WebDriverCache, + WindowKeywords, +) +from SeleniumLibrary.keywords.screenshot import EMBED +from SeleniumLibrary.locators import ElementFinder +from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay + + +__version__ = "6.5.0" + + +class SeleniumLibrary(DynamicCore): + """SeleniumLibrary is a web testing library for Robot Framework. + + This document explains how to use keywords provided by SeleniumLibrary. + For information about installation, support, and more, please visit the + [https://github.com/robotframework/SeleniumLibrary|project pages]. + For more information about Robot Framework, see http://robotframework.org. + + SeleniumLibrary uses the Selenium WebDriver modules internally to + control a web browser. See http://seleniumhq.org for more information + about Selenium in general and SeleniumLibrary README.rst + [https://github.com/robotframework/SeleniumLibrary#browser-drivers|Browser drivers chapter] + for more details about WebDriver binary installation. + + %TOC% + + = Locating elements = + + All keywords in SeleniumLibrary that need to interact with an element + on a web page take an argument typically named ``locator`` that specifies + how to find the element. Most often the locator is given as a string + using the locator syntax described below, but `using WebElements` is + possible too. + + == Locator syntax == + + SeleniumLibrary supports finding elements based on different strategies + such as the element id, XPath expressions, or CSS selectors. The strategy + can either be explicitly specified with a prefix or the strategy can be + implicit. + + === Default locator strategy === + + By default, locators are considered to use the keyword specific default + locator strategy. All keywords support finding elements based on ``id`` + and ``name`` attributes, but some keywords support additional attributes + or other values that make sense in their context. For example, `Click + Link` supports the ``href`` attribute and the link text and addition + to the normal ``id`` and ``name``. + + Examples: + + | `Click Element` | example | # Match based on ``id`` or ``name``. | + | `Click Link` | example | # Match also based on link text and ``href``. | + | `Click Button` | example | # Match based on ``id``, ``name`` or ``value``. | + + If a locator accidentally starts with a prefix recognized as `explicit + locator strategy` or `implicit XPath strategy`, it is possible to use + the explicit ``default`` prefix to enable the default strategy. + + Examples: + + | `Click Element` | name:foo | # Find element with name ``foo``. | + | `Click Element` | default:name:foo | # Use default strategy with value ``name:foo``. | + | `Click Element` | //foo | # Find element using XPath ``//foo``. | + | `Click Element` | default: //foo | # Use default strategy with value ``//foo``. | + + === Explicit locator strategy === + + The explicit locator strategy is specified with a prefix using either + syntax ``strategy:value`` or ``strategy=value``. The former syntax + is preferred because the latter is identical to Robot Framework's + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#named-argument-syntax| + named argument syntax] and that can cause problems. Spaces around + the separator are ignored, so ``id:foo``, ``id: foo`` and ``id : foo`` + are all equivalent. + + Locator strategies that are supported by default are listed in the table + below. In addition to them, it is possible to register `custom locators`. + + | = Strategy = | = Match based on = | = Example = | + | id | Element ``id``. | ``id:example`` | + | name | ``name`` attribute. | ``name:example`` | + | identifier | Either ``id`` or ``name``. | ``identifier:example`` | + | class | Element ``class``. | ``class:example`` | + | tag | Tag name. | ``tag:div`` | + | xpath | XPath expression. | ``xpath://div[@id="example"]`` | + | css | CSS selector. | ``css:div#example`` | + | dom | DOM expression. | ``dom:document.images[5]`` | + | link | Exact text a link has. | ``link:The example`` | + | partial link | Partial link text. | ``partial link:he ex`` | + | sizzle | Sizzle selector deprecated. | ``sizzle:div.example`` | + | data | Element ``data-*`` attribute | ``data:id:my_id`` | + | jquery | jQuery expression. | ``jquery:div.example`` | + | default | Keyword specific default behavior. | ``default:example`` | + + See the `Default locator strategy` section below for more information + about how the default strategy works. Using the explicit ``default`` + prefix is only necessary if the locator value itself accidentally + matches some of the explicit strategies. + + Different locator strategies have different pros and cons. Using ids, + either explicitly like ``id:foo`` or by using the `default locator + strategy` simply like ``foo``, is recommended when possible, because + the syntax is simple and locating elements by id is fast for browsers. + If an element does not have an id or the id is not stable, other + solutions need to be used. If an element has a unique tag name or class, + using ``tag``, ``class`` or ``css`` strategy like ``tag:h1``, + ``class:example`` or ``css:h1.example`` is often an easy solution. In + more complex cases using XPath expressions is typically the best + approach. They are very powerful but a downside is that they can also + get complex. + + Examples: + + | `Click Element` | id:foo | # Element with id 'foo'. | + | `Click Element` | css:div#foo h1 | # h1 element under div with id 'foo'. | + | `Click Element` | xpath: //div[@id="foo"]//h1 | # Same as the above using XPath, not CSS. | + | `Click Element` | xpath: //*[contains(text(), "example")] | # Element containing text 'example'. | + + *NOTE:* + + - The ``strategy:value`` syntax is only supported by SeleniumLibrary 3.0 + and newer. + - Using the ``sizzle`` strategy or its alias ``jquery`` requires that + the system under test contains the jQuery library. + - Prior to SeleniumLibrary 3.0, table related keywords only supported + ``xpath``, ``css`` and ``sizzle/jquery`` strategies. + - ``data`` strategy is conveniance locator that will construct xpath from the parameters. + If you have element like `
`, you locate the element via + ``data:automation:automation-id-2``. This feature was added in SeleniumLibrary 5.2.0 + + === Implicit XPath strategy === + + If the locator starts with ``//`` or multiple opening parenthesis in front + of the ``//``, the locator is considered to be an XPath expression. In other + words, using ``//div`` is equivalent to using explicit ``xpath://div`` and + ``((//div))`` is equivalent to using explicit ``xpath:((//div))`` + + Examples: + + | `Click Element` | //div[@id="foo"]//h1 | + | `Click Element` | (//div)[2] | + + The support for the ``(//`` prefix is new in SeleniumLibrary 3.0. + Supporting multiple opening parenthesis is new in SeleniumLibrary 5.0. + + === Chaining locators === + + It is possible chain multiple locators together as single locator. Each chained locator must start with locator + strategy. Chained locators must be separated with single space, two greater than characters and followed with + space. It is also possible mix different locator strategies, example css or xpath. Also a list can also be + used to specify multiple locators. This is useful, is some part of locator would match as the locator separator + but it should not. Or if there is need to existing WebElement as locator. + + Although all locators support chaining, some locator strategies do not abey the chaining. This is because + some locator strategies use JavaScript to find elements and JavaScript is executed for the whole browser context + and not for the element found be the previous locator. Chaining is supported by locator strategies which + are based on Selenium API, like `xpath` or `css`, but example chaining is not supported by `sizzle` or `jquery + + Examples: + | `Click Element` | css:.bar >> xpath://a | # To find a link which is present after an element with class "bar" | + + List examples: + | ${locator_list} = | `Create List` | css:div#div_id | xpath://*[text(), " >> "] | + | `Page Should Contain Element` | ${locator_list} | | | + | ${element} = | Get WebElement | xpath://*[text(), " >> "] | | + | ${locator_list} = | `Create List` | css:div#div_id | ${element} | + | `Page Should Contain Element` | ${locator_list} | | | + + Chaining locators in new in SeleniumLibrary 5.0 + + == Using WebElements == + + In addition to specifying a locator as a string, it is possible to use + Selenium's WebElement objects. This requires first getting a WebElement, + for example, by using the `Get WebElement` keyword. + + | ${elem} = | `Get WebElement` | id:example | + | `Click Element` | ${elem} | | + + == Custom locators == + + If more complex lookups are required than what is provided through the + default locators, custom lookup strategies can be created. Using custom + locators is a two part process. First, create a keyword that returns + a WebElement that should be acted on: + + | Custom Locator Strategy | [Arguments] | ${browser} | ${locator} | ${tag} | ${constraints} | + | | ${element}= | Execute Javascript | return window.document.getElementById('${locator}'); | + | | [Return] | ${element} | + + This keyword is a reimplementation of the basic functionality of the + ``id`` locator where ``${browser}`` is a reference to a WebDriver + instance and ``${locator}`` is the name of the locator strategy. To use + this locator, it must first be registered by using the + `Add Location Strategy` keyword: + + | `Add Location Strategy` | custom | Custom Locator Strategy | + + The first argument of `Add Location Strategy` specifies the name of + the strategy and it must be unique. After registering the strategy, + the usage is the same as with other locators: + + | `Click Element` | custom:example | + + See the `Add Location Strategy` keyword for more details. + + = Browser and Window = + + There is different conceptual meaning when SeleniumLibrary talks + about windows or browsers. This chapter explains those differences. + + == Browser == + + When `Open Browser` or `Create WebDriver` keyword is called, it + will create a new Selenium WebDriver instance by using the + [https://www.seleniumhq.org/docs/03_webdriver.jsp|Selenium WebDriver] + API. In SeleniumLibrary terms, a new browser is created. It is + possible to start multiple independent browsers (Selenium Webdriver + instances) at the same time, by calling `Open Browser` or + `Create WebDriver` multiple times. These browsers are usually + independent of each other and do not share data like cookies, + sessions or profiles. Typically when the browser starts, it + creates a single window which is shown to the user. + + == Window == + + Windows are the part of a browser that loads the web site and presents + it to the user. All content of the site is the content of the window. + Windows are children of a browser. In SeleniumLibrary browser is a + synonym for WebDriver instance. One browser may have multiple + windows. Windows can appear as tabs, as separate windows or pop-ups with + different position and size. Windows belonging to the same browser + typically share the sessions detail, like cookies. If there is a + need to separate sessions detail, example login with two different + users, two browsers (Selenium WebDriver instances) must be created. + New windows can be opened example by the application under test or + by example `Execute Javascript` keyword: + + | `Execute Javascript` window.open() # Opens a new window with location about:blank + + The example below opens multiple browsers and windows, + to demonstrate how the different keywords can be used to interact + with browsers, and windows attached to these browsers. + + Structure: + | BrowserA + | Window 1 (location=https://robotframework.org/) + | Window 2 (location=https://robocon.io/) + | Window 3 (location=https://github.com/robotframework/) + | + | BrowserB + | Window 1 (location=https://github.com/) + + Example: + | `Open Browser` | https://robotframework.org | ${BROWSER} | alias=BrowserA | # BrowserA with first window is opened. | + | `Execute Javascript` | window.open() | | | # In BrowserA second window is opened. | + | `Switch Window` | locator=NEW | | | # Switched to second window in BrowserA | + | `Go To` | https://robocon.io | | | # Second window navigates to robocon site. | + | `Execute Javascript` | window.open() | | | # In BrowserA third window is opened. | + | ${handle} | `Switch Window` | locator=NEW | | # Switched to third window in BrowserA | + | `Go To` | https://github.com/robotframework/ | | | # Third windows goes to robot framework github site. | + | `Open Browser` | https://github.com | ${BROWSER} | alias=BrowserB | # BrowserB with first windows is opened. | + | ${location} | `Get Location` | | | # ${location} is: https://www.github.com | + | `Switch Window` | ${handle} | browser=BrowserA | | # BrowserA second windows is selected. | + | ${location} | `Get Location` | | | # ${location} = https://robocon.io/ | + | @{locations 1} | `Get Locations` | | | # By default, lists locations under the currectly active browser (BrowserA). | + | @{locations 2} | `Get Locations` | browser=ALL | | # By using browser=ALL argument keyword list all locations from all browsers. | + + The above example, @{locations 1} contains the following items: + https://robotframework.org/, https://robocon.io/ and + https://github.com/robotframework/'. The @{locations 2} + contains the following items: https://robotframework.org/, + https://robocon.io/, https://github.com/robotframework/' + and 'https://github.com/. + + = Browser and Driver options and service class = + + This section talks about how to configure either the browser or + the driver using the options and service arguments of the `Open + Browser` keyword. + + == Configuring the browser using the Selenium Options == + + As noted within the keyword documentation for `Open Browser`, its + ``options`` argument accepts Selenium options in two different + formats: as a string and as Python object which is an instance of + the Selenium options class. + + === Options string format === + + The string format allows defining Selenium options methods + or attributes and their arguments in Robot Framework test data. + The method and attributes names are case and space sensitive and + must match to the Selenium options methods and attributes names. + When defining a method, it must be defined in a similar way as in + python: method name, opening parenthesis, zero to many arguments + and closing parenthesis. If there is a need to define multiple + arguments for a single method, arguments must be separated with + comma, just like in Python. Example: `add_argument("--headless")` + or `add_experimental_option("key", "value")`. Attributes are + defined in a similar way as in Python: attribute name, equal sign, + and attribute value. Example, `headless=True`. Multiple methods + and attributes must be separated by a semicolon. Example: + `add_argument("--headless");add_argument("--start-maximized")`. + + Arguments allow defining Python data types and arguments are + evaluated by using Python + [https://docs.python.org/3/library/ast.html#ast.literal_eval|ast.literal_eval]. + Strings must be quoted with single or double quotes, example "value" + or 'value'. It is also possible to define other Python builtin + data types, example `True` or `None`, by not using quotes + around the arguments. + + The string format is space friendly. Usually, spaces do not alter + the defining methods or attributes. There are two exceptions. + In some Robot Framework test data formats, two or more spaces are + considered as cell separator and instead of defining a single + argument, two or more arguments may be defined. Spaces in string + arguments are not removed and are left as is. Example + `add_argument ( "--headless" )` is same as + `add_argument("--headless")`. But `add_argument(" --headless ")` is + not same same as `add_argument ( "--headless" )`, because + spaces inside of quotes are not removed. Please note that if + options string contains backslash, example a Windows OS path, + the backslash needs escaping both in Robot Framework data and + in Python side. This means single backslash must be writen using + four backslash characters. Example, Windows path: + "C:\\path\\to\\profile" must be written as + "C:\\\\\\\\path\\\\\\to\\\\\\\\profile". Another way to write + backslash is use Python + [https://docs.python.org/3/reference/lexical_analysis.html#string-and-bytes-literals|raw strings] + and example write: r"C:\\\\path\\\\to\\\\profile". + + === Selenium Options as Python class === + + As last format, ``options`` argument also supports receiving + the Selenium options as Python class instance. In this case, the + instance is used as-is and the SeleniumLibrary will not convert + the instance to other formats. + For example, if the following code return value is saved to + `${options}` variable in the Robot Framework data: + | options = webdriver.ChromeOptions() + | options.add_argument('--disable-dev-shm-usage') + | return options + + Then the `${options}` variable can be used as an argument to + ``options``. + + Example the ``options`` argument can be used to launch Chomium-based + applications which utilize the + [https://bitbucket.org/chromiumembedded/cef/wiki/UsingChromeDriver|Chromium Embedded Framework] + . To launch Chromium-based application, use ``options`` to define + `binary_location` attribute and use `add_argument` method to define + `remote-debugging-port` port for the application. Once the browser + is opened, the test can interact with the embedded web-content of + the system under test. + + == Configuring the driver using the Service class == + + With the ``service`` argument, one can setup and configure the driver. For example + one can set the driver location and/port or specify the command line arguments. There + are several browser specific attributes related to logging as well. For the various + Service Class attributes refer to + [https://www.selenium.dev/documentation/webdriver/drivers/service/|the Selenium documentation] + . Currently the ``service`` argument only accepts Selenium service in the string format. + + === Service string format === + + The string format allows for defining Selenium service attributes + and their values in the `Open Browser` keyword. The attributes names + are case and space sensitive and must match to the Selenium attributes + names. Attributes are defined in a similar way as in Python: attribute + name, equal sign, and attribute value. Example, `port=1234`. Multiple + attributes must be separated by a semicolon. Example: + `executable_path='/path/to/driver';port=1234`. Don't have duplicate + attributes, like `service_args=['--append-log', '--readable-timestamp']; + service_args=['--log-level=DEBUG']` as the second will override the first. + Instead combine them as in + `service_args=['--append-log', '--readable-timestamp', '--log-level=DEBUG']` + + Arguments allow defining Python data types and arguments are + evaluated by using Python. Strings must be quoted with single + or double quotes, example "value" or 'value' + + = Timeouts, waits, and delays = + + This section discusses different ways how to wait for elements to + appear on web pages and to slow down execution speed otherwise. + It also explains the `time format` that can be used when setting various + timeouts, waits, and delays. + + == Timeout == + + SeleniumLibrary contains various keywords that have an optional + ``timeout`` argument that specifies how long these keywords should + wait for certain events or actions. These keywords include, for example, + ``Wait ...`` keywords and keywords related to alerts. Additionally + `Execute Async Javascript`. Although it does not have ``timeout``, + argument, uses a timeout to define how long asynchronous JavaScript + can run. + + The default timeout these keywords use can be set globally either by + using the `Set Selenium Timeout` keyword or with the ``timeout`` argument + when `importing` the library. If no default timeout is set globally, the + default is 5 seconds. If None is specified for the timeout argument in the + keywords, the default is used. See `time format` below for supported + timeout syntax. + + == Implicit wait == + + Implicit wait specifies the maximum time how long Selenium waits when + searching for elements. It can be set by using the `Set Selenium Implicit + Wait` keyword or with the ``implicit_wait`` argument when `importing` + the library. See [https://www.seleniumhq.org/docs/04_webdriver_advanced.jsp| + Selenium documentation] for more information about this functionality. + + See `time format` below for supported syntax. + + == Page load == + Page load timeout is the amount of time to wait for page load to complete + until a timeout exception is raised. + + The default page load timeout can be set globally + when `importing` the library with the ``page_load_timeout`` argument + or by using the `Set Selenium Page Load Timeout` keyword. + + See `time format` below for supported timeout syntax. + + Support for page load is new in SeleniumLibrary 6.1 + + == Selenium speed == + + Selenium execution speed can be slowed down globally by using `Set + Selenium speed` keyword. This functionality is designed to be used for + demonstrating or debugging purposes. Using it to make sure that elements + appear on a page is not a good idea. The above-explained timeouts + and waits should be used instead. + + See `time format` below for supported syntax. + + == Time format == + + All timeouts and waits can be given as numbers considered seconds + (e.g. ``0.5`` or ``42``) or in Robot Framework's time syntax + (e.g. ``1.5 seconds`` or ``1 min 30 s``). For more information about + the time syntax see the + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#time-format|Robot Framework User Guide]. + + = Run-on-failure functionality = + + SeleniumLibrary has a handy feature that it can automatically execute + a keyword if any of its own keywords fails. By default, it uses the + `Capture Page Screenshot` keyword, but this can be changed either by + using the `Register Keyword To Run On Failure` keyword or with the + ``run_on_failure`` argument when `importing` the library. It is + possible to use any keyword from any imported library or resource file. + + The run-on-failure functionality can be disabled by using a special value + ``NOTHING`` or anything considered false (see `Boolean arguments`) + such as ``NONE``. + + = Boolean arguments = + + Starting from 5.0 SeleniumLibrary relies on Robot Framework to perform the + boolean conversion based on keyword arguments [https://docs.python.org/3/library/typing.html|type hint]. + More details in Robot Framework + [http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#supported-conversions|user guide] + + Please note SeleniumLibrary 3 and 4 did have own custom methods to covert + arguments to boolean values. + + = EventFiringWebDriver = + + The SeleniumLibrary offers support for + [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver]. + See the Selenium and SeleniumLibrary + [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#EventFiringWebDriver|EventFiringWebDriver support] + documentation for further details. + + EventFiringWebDriver is new in SeleniumLibrary 4.0 + + = Thread support = + + SeleniumLibrary is not thread-safe. This is mainly due because the underlying + [https://github.com/SeleniumHQ/selenium/wiki/Frequently-Asked-Questions#q-is-webdriver-thread-safe| + Selenium tool is not thread-safe] within one browser/driver instance. + Because of the limitation in the Selenium side, the keywords or the + API provided by the SeleniumLibrary is not thread-safe. + + = Plugins = + + SeleniumLibrary offers plugins as a way to modify and add library keywords and modify some of the internal + functionality without creating a new library or hacking the source code. See + [https://github.com/robotframework/SeleniumLibrary/blob/master/docs/extending/extending.rst#Plugins|plugin API] + documentation for further details. + + Plugin API is new SeleniumLibrary 4.0 + + = Language = + + SeleniumLibrary offers the possibility to translate keyword names and documentation to new language. If language + is defined, SeleniumLibrary will search from + [https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#module-search-path | module search path] + for Python packages starting with `robotframework-seleniumlibrary-translation` by using the + [https://packaging.python.org/en/latest/guides/creating-and-discovering-plugins/ | Python pluging API]. The Library + is using naming convention to find Python plugins. + + The package must implement a single API call, ``get_language`` without any arguments. The method must return a + dictionary containing two keys: ``language`` and ``path``. The language key value defines which language + the package contains. Also the value should match (case insensitive) the library ``language`` import parameter. + The path parameter value should be full path to the translation file. + + == Translation file == + + The file name or extension is not important, but data must be in [https://www.json.org/json-en.html | json] + format. The keys of json are the methods names, not the keyword names, which implements keywords. Value of + key is json object which contains two keys: ``name`` and ``doc``. The ``name`` key contains the keyword + translated name and `doc` contains translated documentation. Providing doc and name are optional, example + translation json file can only provide translations to keyword names or only to documentation. But it is + always recommended to provide translation to both name and doc. Special key ``__intro__`` is for class level + documentation and ``__init__`` is for init level documentation. These special values ``name`` can not be + translated, instead ``name`` should be kept the same. + + == Generating template translation file == + + Template translation file, with English language can be created by running: + `rfselib translation /path/to/translation.json` command. Command does not provide translations to other + languages, it only provides easy way to create full list keywords and their documentation in correct + format. It is also possible to add keywords from library plugins by providing `--plugins` arguments + to command. Example: `rfselib translation --plugins myplugin.SomePlugin /path/to/translation.json` The + generated json file contains `sha256` key, which contains the sha256 sum of the library documentation. + The sha256 sum is used by `rfselib translation --compare /path/to/translation.json` command, which compares + the translation to the library and prints outs a table which tells if there are changes needed for + the translation file. + + Example project for translation can be found from + [https://github.com/MarketSquare/robotframework-seleniumlibrary-translation-fi | robotframework-seleniumlibrary-translation-fi] + repository. + """ + + ROBOT_LIBRARY_SCOPE = "GLOBAL" + ROBOT_LIBRARY_VERSION = __version__ + + def __init__( + self, + timeout=timedelta(seconds=5), + implicit_wait=timedelta(seconds=0), + run_on_failure="Capture Page Screenshot", + screenshot_root_directory: Optional[str] = None, + plugins: Optional[str] = None, + event_firing_webdriver: Optional[str] = None, + page_load_timeout=timedelta(minutes=5), + action_chain_delay=timedelta(seconds=0.25), + language: Optional[str] = None, + ): + """SeleniumLibrary can be imported with several optional arguments. + + - ``timeout``: + Default value for `timeouts` used with ``Wait ...`` keywords. + - ``implicit_wait``: + Default value for `implicit wait` used when locating elements. + - ``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. + If not given, the directory where the log file is written is used. + - ``plugins``: + Allows extending the SeleniumLibrary with external Python classes. + - ``event_firing_webdriver``: + Class for wrapping Selenium with + [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] + - ``page_load_timeout``: + Default value to wait for page load to complete until a timeout exception is raised. + - ``action_chain_delay``: + Default value for `ActionChains` delay to wait in between actions. + - ``language``: + Defines language which is used to translate keyword names and documentation. + """ + self.timeout = _convert_timeout(timeout) + self.implicit_wait = _convert_timeout(implicit_wait) + self.action_chain_delay = _convert_delay(action_chain_delay) + self.page_load_timeout = _convert_timeout(page_load_timeout) + self.speed = 0.0 + self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( + run_on_failure + ) + self._running_on_failure_keyword = False + self.screenshot_root_directory = screenshot_root_directory + self._resolve_screenshot_root_directory() + self._element_finder = ElementFinder(self) + self._plugin_keywords = [] + libraries = [ + AlertKeywords(self), + BrowserManagementKeywords(self), + CookieKeywords(self), + ElementKeywords(self), + ExpectedConditionKeywords(self), + FormElementKeywords(self), + FrameKeywords(self), + JavaScriptKeywords(self), + RunOnFailureKeywords(self), + ScreenshotKeywords(self), + SelectElementKeywords(self), + TableElementKeywords(self), + WaitingKeywords(self), + WindowKeywords(self), + ] + self.ROBOT_LIBRARY_LISTENER = LibraryListener() + self._running_keyword = None + self.event_firing_webdriver = None + if is_truthy(event_firing_webdriver): + self.event_firing_webdriver = self._parse_listener(event_firing_webdriver) + self._plugins = [] + if is_truthy(plugins): + plugin_libs = self._parse_plugins(plugins) + self._plugins = plugin_libs + libraries = libraries + plugin_libs + self._drivers = WebDriverCache() + translation_file = self._get_translation(language) + DynamicCore.__init__(self, libraries, translation_file) + + def run_keyword(self, name: str, args: tuple, kwargs: dict): + try: + return DynamicCore.run_keyword(self, name, args, kwargs) + except Exception: + self.failure_occurred() + raise + + def get_keyword_tags(self, name: str) -> list: + tags = list(DynamicCore.get_keyword_tags(self, name)) + if name in self._plugin_keywords: + tags.append("plugin") + return tags + + def get_keyword_documentation(self, name: str) -> str: + if name == "__intro__": + return self._get_intro_documentation() + return DynamicCore.get_keyword_documentation(self, name) + + def _parse_plugin_doc(self): + Doc = namedtuple("Doc", "doc, name") + for plugin in self._plugins: + yield Doc( + doc=getdoc(plugin) or "No plugin documentation found.", + name=plugin.__class__.__name__, + ) + + def _get_intro_documentation(self): + intro = DynamicCore.get_keyword_documentation(self, "__intro__") + for plugin_doc in self._parse_plugin_doc(): + intro = f"{intro}\n\n" + intro = f"{intro}= Plugin: {plugin_doc.name} =\n\n" + intro = f"{intro}{plugin_doc.doc}" + return intro + + def register_driver(self, driver: WebDriver, alias: str): + """Add's a `driver` to the library WebDriverCache. + + :param driver: Instance of the Selenium `WebDriver`. + :type driver: selenium.webdriver.remote.webdriver.WebDriver + :param alias: Alias given for this `WebDriver` instance. + :type alias: str + :return: The index of the `WebDriver` instance. + :rtype: int + """ + return self._drivers.register(driver, alias) + + def failure_occurred(self): + """Method that is executed when a SeleniumLibrary keyword fails. + + By default, executes the registered run-on-failure keyword. + Libraries extending SeleniumLibrary can overwrite this hook + method if they want to provide custom functionality instead. + """ + if self._running_on_failure_keyword or not self.run_on_failure_keyword: + return + try: + self._running_on_failure_keyword = True + if self.run_on_failure_keyword.lower() == "capture page screenshot": + self.capture_page_screenshot() + else: + BuiltIn().run_keyword(self.run_on_failure_keyword) + except Exception as err: + logger.warn( + f"Keyword '{self.run_on_failure_keyword}' could not be run on failure: {err}" + ) + finally: + self._running_on_failure_keyword = False + + @property + def driver(self) -> WebDriver: + """Current active driver. + + :rtype: selenium.webdriver.remote.webdriver.WebDriver + :raises SeleniumLibrary.errors.NoOpenBrowser: If browser is not open. + """ + if not self._drivers.current: + raise NoOpenBrowser("No browser is open.") + return self._drivers.current + + def find_element( + self, locator: str, parent: Optional[WebElement] = None + ) -> WebElement: + """Find element matching `locator`. + + :param locator: Locator to use when searching the element. + See library documentation for the supported locator syntax. + :type locator: str or selenium.webdriver.remote.webelement.WebElement + :param parent: Optional parent `WebElememt` to search child elements + from. By default, search starts from the root using `WebDriver`. + :type parent: selenium.webdriver.remote.webelement.WebElement + :return: Found `WebElement`. + :rtype: selenium.webdriver.remote.webelement.WebElement + :raises SeleniumLibrary.errors.ElementNotFound: If element not found. + """ + return self._element_finder.find(locator, parent=parent) + + def find_elements( + self, locator: str, parent: WebElement = None + ) -> List[WebElement]: + """Find all elements matching `locator`. + + :param locator: Locator to use when searching the element. + See library documentation for the supported locator syntax. + :type locator: str or selenium.webdriver.remote.webelement.WebElement + :param parent: Optional parent `WebElememt` to search child elements + from. By default, search starts from the root using `WebDriver`. + :type parent: selenium.webdriver.remote.webelement.WebElement + :return: list of found `WebElement` or e,mpty if elements are not found. + :rtype: list[selenium.webdriver.remote.webelement.WebElement] + """ + return self._element_finder.find( + locator, first_only=False, required=False, parent=parent + ) + + def _parse_plugins(self, plugins): + libraries = [] + importer = Importer("test library") + for parsed_plugin in self._string_to_modules(plugins): + plugin = importer.import_class_or_module(parsed_plugin.module) + if not isclass(plugin): + message = f"Importing test library: '{parsed_plugin.module}' failed." + raise DataError(message) + plugin = plugin(self, *parsed_plugin.args, **parsed_plugin.kw_args) + if not isinstance(plugin, LibraryComponent): + message = ( + "Plugin does not inherit SeleniumLibrary.base.LibraryComponent" + ) + raise PluginError(message) + self._store_plugin_keywords(plugin) + libraries.append(plugin) + return libraries + + def _parse_listener(self, event_firing_webdriver): + listener_module = self._string_to_modules(event_firing_webdriver) + listener_count = len(listener_module) + if listener_count > 1: + message = f"Is is possible import only one listener but there was {listener_count} listeners." + raise ValueError(message) + listener_module = listener_module[0] + importer = Importer("test library") + listener = importer.import_class_or_module(listener_module.module) + if not isclass(listener): + message = f"Importing test Selenium lister class '{listener_module.module}' failed." + raise DataError(message) + return listener + + def _string_to_modules(self, modules): + Module = namedtuple("Module", "module, args, kw_args") + parsed_modules = [] + for module in modules.split(","): + module = module.strip() + module_and_args = module.split(";") + module_name = module_and_args.pop(0) + kw_args = {} + args = [] + for argument in module_and_args: + if "=" in argument: + key, value = argument.split("=") + kw_args[key] = value + else: + args.append(argument) + module = Module(module=module_name, args=args, kw_args=kw_args) + parsed_modules.append(module) + return parsed_modules + + def _store_plugin_keywords(self, plugin): + dynamic_core = DynamicCore([plugin]) + self._plugin_keywords.extend(dynamic_core.get_keyword_names()) + + def _resolve_screenshot_root_directory(self): + screenshot_root_directory = self.screenshot_root_directory + if is_string(screenshot_root_directory): + if screenshot_root_directory.upper() == EMBED: + self.screenshot_root_directory = EMBED + + @staticmethod + def _get_translation(language: Union[str, None]) -> Union[Path, None]: + if not language: + return None + discovered_plugins = { + name: importlib.import_module(name) + for _, name, _ in pkgutil.iter_modules() + if name.startswith("robotframework_seleniumlibrary_translation") + } + for plugin in discovered_plugins.values(): + try: + data = plugin.get_language() + except AttributeError: + continue + if data.get("language", "").lower() == language.lower() and data.get( + "path" + ): + return Path(data.get("path")).absolute() + return None From f9cd72ab81717ae1d508a5849bbd9e19eb94937d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 16:14:38 -0400 Subject: [PATCH 313/407] Generate stub file for 6.5.0 --- src/SeleniumLibrary/__init__.pyi | 426 +++++++++++++++---------------- 1 file changed, 213 insertions(+), 213 deletions(-) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index 2d8f09c12..d17efdd1c 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -1,213 +1,213 @@ -from datetime import timedelta -from typing import Any, Optional, Union - -import selenium -from selenium.webdriver.remote.webdriver import WebDriver -from selenium.webdriver.remote.webelement import WebElement - -class SeleniumLibrary: - def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional] = None, plugins: Optional[Optional] = None, event_firing_webdriver: Optional[Optional] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25), language: Optional[Optional] = None): ... - def add_cookie(self, name: str, value: str, path: Optional[Optional] = None, domain: Optional[Optional] = None, secure: Optional[Optional] = None, expiry: Optional[Optional] = None): ... - def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... - def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... - def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... - def assign_id_to_element(self, locator: Union, id: str): ... - def capture_element_screenshot(self, locator: Union, filename: str = 'selenium-element-screenshot-{index}.png'): ... - def capture_page_screenshot(self, filename: str = 'selenium-screenshot-{index}.png'): ... - def checkbox_should_be_selected(self, locator: Union): ... - def checkbox_should_not_be_selected(self, locator: Union): ... - def choose_file(self, locator: Union, file_path: str): ... - def clear_element_text(self, locator: Union): ... - def click_button(self, locator: Union, modifier: Union = False): ... - def click_element(self, locator: Union, modifier: Union = False, action_chain: bool = False): ... - def click_element_at_coordinates(self, locator: Union, xoffset: int, yoffset: int): ... - def click_image(self, locator: Union, modifier: Union = False): ... - def click_link(self, locator: Union, modifier: Union = False): ... - def close_all_browsers(self): ... - def close_browser(self): ... - def close_window(self): ... - def cover_element(self, locator: Union): ... - def create_webdriver(self, driver_name: str, alias: Optional[Optional] = None, kwargs: Optional[Optional] = None, **init_kwargs): ... - def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... - def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... - def delete_all_cookies(self): ... - def delete_cookie(self, name): ... - def double_click_element(self, locator: Union): ... - def drag_and_drop(self, locator: Union, target: Union): ... - def drag_and_drop_by_offset(self, locator: Union, xoffset: int, yoffset: int): ... - def element_attribute_value_should_be(self, locator: Union, attribute: str, expected: Optional, message: Optional[Optional] = None): ... - def element_should_be_disabled(self, locator: Union): ... - def element_should_be_enabled(self, locator: Union): ... - def element_should_be_focused(self, locator: Union): ... - def element_should_be_visible(self, locator: Union, message: Optional[Optional] = None): ... - def element_should_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... - def element_should_not_be_visible(self, locator: Union, message: Optional[Optional] = None): ... - def element_should_not_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... - def element_text_should_be(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... - def element_text_should_not_be(self, locator: Union, not_expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... - def execute_async_javascript(self, *code: Any): ... - def execute_javascript(self, *code: Any): ... - def frame_should_contain(self, locator: Union, text: str, loglevel: str = 'TRACE'): ... - def get_action_chain_delay(self): ... - def get_all_links(self): ... - def get_browser_aliases(self): ... - def get_browser_ids(self): ... - def get_cookie(self, name: str): ... - def get_cookies(self, as_dict: bool = False): ... - def get_dom_attribute(self, locator: Union, attribute: str): ... - def get_element_attribute(self, locator: Union, attribute: str): ... - def get_element_count(self, locator: Union): ... - def get_element_size(self, locator: Union): ... - def get_horizontal_position(self, locator: Union): ... - def get_list_items(self, locator: Union, values: bool = False): ... - def get_location(self): ... - def get_locations(self, browser: str = 'CURRENT'): ... - def get_property(self, locator: Union, property: str): ... - def get_selected_list_label(self, locator: Union): ... - def get_selected_list_labels(self, locator: Union): ... - def get_selected_list_value(self, locator: Union): ... - def get_selected_list_values(self, locator: Union): ... - def get_selenium_implicit_wait(self): ... - def get_selenium_page_load_timeout(self): ... - def get_selenium_speed(self): ... - def get_selenium_timeout(self): ... - def get_session_id(self): ... - def get_source(self): ... - def get_table_cell(self, locator: Union, row: int, column: int, loglevel: str = 'TRACE'): ... - def get_text(self, locator: Union): ... - def get_title(self): ... - def get_value(self, locator: Union): ... - def get_vertical_position(self, locator: Union): ... - def get_webelement(self, locator: Union): ... - def get_webelements(self, locator: Union): ... - def get_window_handles(self, browser: str = 'CURRENT'): ... - def get_window_identifiers(self, browser: str = 'CURRENT'): ... - def get_window_names(self, browser: str = 'CURRENT'): ... - def get_window_position(self): ... - def get_window_size(self, inner: bool = False): ... - def get_window_titles(self, browser: str = 'CURRENT'): ... - def go_back(self): ... - def go_to(self, url): ... - def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... - def input_password(self, locator: Union, password: str, clear: bool = True): ... - def input_text(self, locator: Union, text: str, clear: bool = True): ... - def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... - def list_selection_should_be(self, locator: Union, *expected: str): ... - def list_should_have_no_selections(self, locator: Union): ... - def location_should_be(self, url: str, message: Optional[Optional] = None): ... - def location_should_contain(self, expected: str, message: Optional[Optional] = None): ... - def log_location(self): ... - def log_source(self, loglevel: str = 'INFO'): ... - def log_title(self): ... - def maximize_browser_window(self): ... - def minimize_browser_window(self): ... - def mouse_down(self, locator: Union): ... - def mouse_down_on_image(self, locator: Union): ... - def mouse_down_on_link(self, locator: Union): ... - def mouse_out(self, locator: Union): ... - def mouse_over(self, locator: Union): ... - def mouse_up(self, locator: Union): ... - def open_browser(self, url: Optional[Optional] = None, browser: str = 'firefox', alias: Optional[Optional] = None, remote_url: Union = False, desired_capabilities: Optional[Union] = None, ff_profile_dir: Optional[Union] = None, options: Optional[Any] = None, service_log_path: Optional[Optional] = None, executable_path: Optional[Optional] = None, service: Optional[Any] = None): ... - def open_context_menu(self, locator: Union): ... - def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE', limit: Optional[Optional] = None): ... - def page_should_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... - def page_should_not_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def page_should_not_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... - def press_key(self, locator: Union, key: str): ... - def press_keys(self, locator: Optional[Union] = None, *keys: str): ... - def print_page_as_pdf(self, filename: str = 'selenium-page-{index}.pdf', background: Optional[Optional] = None, margin_bottom: Optional[Optional] = None, margin_left: Optional[Optional] = None, margin_right: Optional[Optional] = None, margin_top: Optional[Optional] = None, orientation: Optional[Optional] = None, page_height: Optional[Optional] = None, page_ranges: Optional[Optional] = None, page_width: Optional[Optional] = None, scale: Optional[Optional] = None, shrink_to_fit: Optional[Optional] = None): ... - def radio_button_should_be_set_to(self, group_name: str, value: str): ... - def radio_button_should_not_be_selected(self, group_name: str): ... - def register_keyword_to_run_on_failure(self, keyword: Optional): ... - def reload_page(self): ... - def remove_location_strategy(self, strategy_name: str): ... - def scroll_element_into_view(self, locator: Union): ... - def select_all_from_list(self, locator: Union): ... - def select_checkbox(self, locator: Union): ... - def select_frame(self, locator: Union): ... - def select_from_list_by_index(self, locator: Union, *indexes: str): ... - def select_from_list_by_label(self, locator: Union, *labels: str): ... - def select_from_list_by_value(self, locator: Union, *values: str): ... - def select_radio_button(self, group_name: str, value: str): ... - def set_action_chain_delay(self, value: timedelta): ... - def set_browser_implicit_wait(self, value: timedelta): ... - def set_focus_to_element(self, locator: Union): ... - def set_screenshot_directory(self, path: Optional): ... - def set_selenium_implicit_wait(self, value: timedelta): ... - def set_selenium_page_load_timeout(self, value: timedelta): ... - def set_selenium_speed(self, value: timedelta): ... - def set_selenium_timeout(self, value: timedelta): ... - def set_window_position(self, x: int, y: int): ... - def set_window_size(self, width: int, height: int, inner: bool = False): ... - def simulate_event(self, locator: Union, event: str): ... - def submit_form(self, locator: Optional[Union] = None): ... - def switch_browser(self, index_or_alias: str): ... - def switch_window(self, locator: Union = MAIN, timeout: Optional[Optional] = None, browser: str = 'CURRENT'): ... - def table_cell_should_contain(self, locator: Union, row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_column_should_contain(self, locator: Union, column: int, expected: str, loglevel: str = 'TRACE'): ... - def table_footer_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... - def table_header_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... - def table_row_should_contain(self, locator: Union, row: int, expected: str, loglevel: str = 'TRACE'): ... - def table_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... - def textarea_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... - def textarea_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... - def textfield_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... - def textfield_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... - def title_should_be(self, title: str, message: Optional[Optional] = None): ... - def unselect_all_from_list(self, locator: Union): ... - def unselect_checkbox(self, locator: Union): ... - def unselect_frame(self): ... - def unselect_from_list_by_index(self, locator: Union, *indexes: str): ... - def unselect_from_list_by_label(self, locator: Union, *labels: str): ... - def unselect_from_list_by_value(self, locator: Union, *values: str): ... - def wait_for_condition(self, condition: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_for_expected_condition(self, condition: string, *args, timeout: Optional = 10): ... - def wait_until_element_contains(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_element_does_not_contain(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_element_is_enabled(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_element_is_not_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_element_is_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_location_contains(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... - def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... - def wait_until_location_is(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... - def wait_until_location_is_not(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... - def wait_until_page_contains(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_page_contains_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... - def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... - def wait_until_page_does_not_contain_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... - # methods from library. - def add_library_components(self, library_components): ... - def get_keyword_names(self): ... - def run_keyword(self, name: str, args: tuple, kwargs: Optional[dict] = None): ... - def get_keyword_arguments(self, name: str): ... - def get_keyword_tags(self, name: str): ... - def get_keyword_documentation(self, name: str): ... - def get_keyword_types(self, name: str): ... - def get_keyword_source(self, keyword_name: str): ... - def failure_occurred(self): ... - def register_driver(self, driver: WebDriver, alias: str): ... - @property - def driver(self) -> WebDriver: ... - def find_element(self, locator: str, parent: Optional[WebElement] = None): ... - def find_elements(self, locator: str, parent: WebElement = None): ... - def _parse_plugins(self, plugins: Any): ... - def _parse_plugin_doc(self): ... - def _get_intro_documentation(self): ... - def _parse_listener(self, event_firing_webdriver: Any): ... - def _string_to_modules(self, modules: Any): ... - def _store_plugin_keywords(self, plugin): ... - def _resolve_screenshot_root_directory(self): ... +from datetime import timedelta +from typing import Any, Optional, Union + +import selenium +from selenium.webdriver.remote.webdriver import WebDriver +from selenium.webdriver.remote.webelement import WebElement + +class SeleniumLibrary: + def __init__(self, timeout = timedelta(seconds=5.0), implicit_wait = timedelta(seconds=0.0), run_on_failure = 'Capture Page Screenshot', screenshot_root_directory: Optional[Optional] = None, plugins: Optional[Optional] = None, event_firing_webdriver: Optional[Optional] = None, page_load_timeout = timedelta(seconds=300.0), action_chain_delay = timedelta(seconds=0.25), language: Optional[Optional] = None): ... + def add_cookie(self, name: str, value: str, path: Optional[Optional] = None, domain: Optional[Optional] = None, secure: Optional[Optional] = None, expiry: Optional[Optional] = None): ... + def add_location_strategy(self, strategy_name: str, strategy_keyword: str, persist: bool = False): ... + def alert_should_be_present(self, text: str = '', action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def alert_should_not_be_present(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def assign_id_to_element(self, locator: Union, id: str): ... + def capture_element_screenshot(self, locator: Union, filename: str = 'selenium-element-screenshot-{index}.png'): ... + def capture_page_screenshot(self, filename: str = 'selenium-screenshot-{index}.png'): ... + def checkbox_should_be_selected(self, locator: Union): ... + def checkbox_should_not_be_selected(self, locator: Union): ... + def choose_file(self, locator: Union, file_path: str): ... + def clear_element_text(self, locator: Union): ... + def click_button(self, locator: Union, modifier: Union = False): ... + def click_element(self, locator: Union, modifier: Union = False, action_chain: bool = False): ... + def click_element_at_coordinates(self, locator: Union, xoffset: int, yoffset: int): ... + def click_image(self, locator: Union, modifier: Union = False): ... + def click_link(self, locator: Union, modifier: Union = False): ... + def close_all_browsers(self): ... + def close_browser(self): ... + def close_window(self): ... + def cover_element(self, locator: Union): ... + def create_webdriver(self, driver_name: str, alias: Optional[Optional] = None, kwargs: Optional[Optional] = None, **init_kwargs): ... + def current_frame_should_contain(self, text: str, loglevel: str = 'TRACE'): ... + def current_frame_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... + def delete_all_cookies(self): ... + def delete_cookie(self, name): ... + def double_click_element(self, locator: Union): ... + def drag_and_drop(self, locator: Union, target: Union): ... + def drag_and_drop_by_offset(self, locator: Union, xoffset: int, yoffset: int): ... + def element_attribute_value_should_be(self, locator: Union, attribute: str, expected: Optional, message: Optional[Optional] = None): ... + def element_should_be_disabled(self, locator: Union): ... + def element_should_be_enabled(self, locator: Union): ... + def element_should_be_focused(self, locator: Union): ... + def element_should_be_visible(self, locator: Union, message: Optional[Optional] = None): ... + def element_should_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_should_not_be_visible(self, locator: Union, message: Optional[Optional] = None): ... + def element_should_not_contain(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_text_should_be(self, locator: Union, expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def element_text_should_not_be(self, locator: Union, not_expected: Optional, message: Optional[Optional] = None, ignore_case: bool = False): ... + def execute_async_javascript(self, *code: Any): ... + def execute_javascript(self, *code: Any): ... + def frame_should_contain(self, locator: Union, text: str, loglevel: str = 'TRACE'): ... + def get_action_chain_delay(self): ... + def get_all_links(self): ... + def get_browser_aliases(self): ... + def get_browser_ids(self): ... + def get_cookie(self, name: str): ... + def get_cookies(self, as_dict: bool = False): ... + def get_dom_attribute(self, locator: Union, attribute: str): ... + def get_element_attribute(self, locator: Union, attribute: str): ... + def get_element_count(self, locator: Union): ... + def get_element_size(self, locator: Union): ... + def get_horizontal_position(self, locator: Union): ... + def get_list_items(self, locator: Union, values: bool = False): ... + def get_location(self): ... + def get_locations(self, browser: str = 'CURRENT'): ... + def get_property(self, locator: Union, property: str): ... + def get_selected_list_label(self, locator: Union): ... + def get_selected_list_labels(self, locator: Union): ... + def get_selected_list_value(self, locator: Union): ... + def get_selected_list_values(self, locator: Union): ... + def get_selenium_implicit_wait(self): ... + def get_selenium_page_load_timeout(self): ... + def get_selenium_speed(self): ... + def get_selenium_timeout(self): ... + def get_session_id(self): ... + def get_source(self): ... + def get_table_cell(self, locator: Union, row: int, column: int, loglevel: str = 'TRACE'): ... + def get_text(self, locator: Union): ... + def get_title(self): ... + def get_value(self, locator: Union): ... + def get_vertical_position(self, locator: Union): ... + def get_webelement(self, locator: Union): ... + def get_webelements(self, locator: Union): ... + def get_window_handles(self, browser: str = 'CURRENT'): ... + def get_window_identifiers(self, browser: str = 'CURRENT'): ... + def get_window_names(self, browser: str = 'CURRENT'): ... + def get_window_position(self): ... + def get_window_size(self, inner: bool = False): ... + def get_window_titles(self, browser: str = 'CURRENT'): ... + def go_back(self): ... + def go_to(self, url): ... + def handle_alert(self, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def input_password(self, locator: Union, password: str, clear: bool = True): ... + def input_text(self, locator: Union, text: str, clear: bool = True): ... + def input_text_into_alert(self, text: str, action: str = 'ACCEPT', timeout: Optional[Optional] = None): ... + def list_selection_should_be(self, locator: Union, *expected: str): ... + def list_should_have_no_selections(self, locator: Union): ... + def location_should_be(self, url: str, message: Optional[Optional] = None): ... + def location_should_contain(self, expected: str, message: Optional[Optional] = None): ... + def log_location(self): ... + def log_source(self, loglevel: str = 'INFO'): ... + def log_title(self): ... + def maximize_browser_window(self): ... + def minimize_browser_window(self): ... + def mouse_down(self, locator: Union): ... + def mouse_down_on_image(self, locator: Union): ... + def mouse_down_on_link(self, locator: Union): ... + def mouse_out(self, locator: Union): ... + def mouse_over(self, locator: Union): ... + def mouse_up(self, locator: Union): ... + def open_browser(self, url: Optional[Optional] = None, browser: str = 'firefox', alias: Optional[Optional] = None, remote_url: Union = False, desired_capabilities: Optional[Union] = None, ff_profile_dir: Optional[Union] = None, options: Optional[Optional] = None, service_log_path: Optional[Optional] = None, executable_path: Optional[Optional] = None, service: Optional[Optional] = None): ... + def open_context_menu(self, locator: Union): ... + def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... + def page_should_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE', limit: Optional[Optional] = None): ... + def page_should_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain(self, text: str, loglevel: str = 'TRACE'): ... + def page_should_not_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_checkbox(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_element(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_image(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_link(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_list(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_radio_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def page_should_not_contain_textfield(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... + def press_key(self, locator: Union, key: str): ... + def press_keys(self, locator: Optional[Union] = None, *keys: str): ... + def print_page_as_pdf(self, filename: str = 'selenium-page-{index}.pdf', background: Optional[Optional] = None, margin_bottom: Optional[Optional] = None, margin_left: Optional[Optional] = None, margin_right: Optional[Optional] = None, margin_top: Optional[Optional] = None, orientation: Optional[Optional] = None, page_height: Optional[Optional] = None, page_ranges: Optional[Optional] = None, page_width: Optional[Optional] = None, scale: Optional[Optional] = None, shrink_to_fit: Optional[Optional] = None): ... + def radio_button_should_be_set_to(self, group_name: str, value: str): ... + def radio_button_should_not_be_selected(self, group_name: str): ... + def register_keyword_to_run_on_failure(self, keyword: Optional): ... + def reload_page(self): ... + def remove_location_strategy(self, strategy_name: str): ... + def scroll_element_into_view(self, locator: Union): ... + def select_all_from_list(self, locator: Union): ... + def select_checkbox(self, locator: Union): ... + def select_frame(self, locator: Union): ... + def select_from_list_by_index(self, locator: Union, *indexes: str): ... + def select_from_list_by_label(self, locator: Union, *labels: str): ... + def select_from_list_by_value(self, locator: Union, *values: str): ... + def select_radio_button(self, group_name: str, value: str): ... + def set_action_chain_delay(self, value: timedelta): ... + def set_browser_implicit_wait(self, value: timedelta): ... + def set_focus_to_element(self, locator: Union): ... + def set_screenshot_directory(self, path: Optional): ... + def set_selenium_implicit_wait(self, value: timedelta): ... + def set_selenium_page_load_timeout(self, value: timedelta): ... + def set_selenium_speed(self, value: timedelta): ... + def set_selenium_timeout(self, value: timedelta): ... + def set_window_position(self, x: int, y: int): ... + def set_window_size(self, width: int, height: int, inner: bool = False): ... + def simulate_event(self, locator: Union, event: str): ... + def submit_form(self, locator: Optional[Union] = None): ... + def switch_browser(self, index_or_alias: str): ... + def switch_window(self, locator: Union = MAIN, timeout: Optional[Optional] = None, browser: str = 'CURRENT'): ... + def table_cell_should_contain(self, locator: Union, row: int, column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_column_should_contain(self, locator: Union, column: int, expected: str, loglevel: str = 'TRACE'): ... + def table_footer_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def table_header_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def table_row_should_contain(self, locator: Union, row: int, expected: str, loglevel: str = 'TRACE'): ... + def table_should_contain(self, locator: Union, expected: str, loglevel: str = 'TRACE'): ... + def textarea_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textarea_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textfield_should_contain(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def textfield_value_should_be(self, locator: Union, expected: str, message: Optional[Optional] = None): ... + def title_should_be(self, title: str, message: Optional[Optional] = None): ... + def unselect_all_from_list(self, locator: Union): ... + def unselect_checkbox(self, locator: Union): ... + def unselect_frame(self): ... + def unselect_from_list_by_index(self, locator: Union, *indexes: str): ... + def unselect_from_list_by_label(self, locator: Union, *labels: str): ... + def unselect_from_list_by_value(self, locator: Union, *values: str): ... + def wait_for_condition(self, condition: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_for_expected_condition(self, condition: string, *args, timeout: Optional = 10): ... + def wait_until_element_contains(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_does_not_contain(self, locator: Union, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_enabled(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_not_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_element_is_visible(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_location_contains(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_does_not_contain(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_is(self, expected: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_location_is_not(self, location: str, timeout: Optional[Optional] = None, message: Optional[Optional] = None): ... + def wait_until_page_contains(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_page_contains_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... + def wait_until_page_does_not_contain(self, text: str, timeout: Optional[Optional] = None, error: Optional[Optional] = None): ... + def wait_until_page_does_not_contain_element(self, locator: Union, timeout: Optional[Optional] = None, error: Optional[Optional] = None, limit: Optional[Optional] = None): ... + # methods from library. + def add_library_components(self, library_components): ... + def get_keyword_names(self): ... + def run_keyword(self, name: str, args: tuple, kwargs: Optional[dict] = None): ... + def get_keyword_arguments(self, name: str): ... + def get_keyword_tags(self, name: str): ... + def get_keyword_documentation(self, name: str): ... + def get_keyword_types(self, name: str): ... + def get_keyword_source(self, keyword_name: str): ... + def failure_occurred(self): ... + def register_driver(self, driver: WebDriver, alias: str): ... + @property + def driver(self) -> WebDriver: ... + def find_element(self, locator: str, parent: Optional[WebElement] = None): ... + def find_elements(self, locator: str, parent: WebElement = None): ... + def _parse_plugins(self, plugins: Any): ... + def _parse_plugin_doc(self): ... + def _get_intro_documentation(self): ... + def _parse_listener(self, event_firing_webdriver: Any): ... + def _string_to_modules(self, modules: Any): ... + def _store_plugin_keywords(self, plugin): ... + def _resolve_screenshot_root_directory(self): ... From 00ac2cd9a191c091c908749ff3ed091d70ed0279 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 16:15:09 -0400 Subject: [PATCH 314/407] Generated docs for version 6.5.0 --- docs/SeleniumLibrary.html | 3746 ++++++++++++++++++------------------- 1 file changed, 1873 insertions(+), 1873 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 49a9a757a..cf4ebe698 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -1,1873 +1,1873 @@ - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Opening library documentation failed

-
    -
  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • -
-
- - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From f74ea79449ca7b1de97e4b3c1143134fdc1035d4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 15 Jun 2024 16:16:00 -0400 Subject: [PATCH 315/407] Regenerated project docs --- docs/index.html | 368 ++++++++++++++++++++++++------------------------ 1 file changed, 184 insertions(+), 184 deletions(-) diff --git a/docs/index.html b/docs/index.html index 9ecf5168b..d6adb5082 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,184 +1,184 @@ - - - - - - -SeleniumLibrary - - - - -
-

SeleniumLibrary

- - -
-

Introduction

-

SeleniumLibrary is a web testing library for Robot Framework that -utilizes the Selenium tool internally. The project is hosted on GitHub -and downloads can be found from PyPI.

-

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11. -In addition to the normal Python interpreter, it works also -with PyPy.

-

SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to -Selenium2Library and then later renamed back to SeleniumLibrary. -See the VERSIONS.rst for more information about different versions and the -overall project history.

- -https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version - - -https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg - - -https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg - - -https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master - -
-
-

Keyword Documentation

-

See keyword documentation for available keywords and more information -about the library in general.

-
-
-

Installation

-

The recommended installation method is using pip:

-
pip install --upgrade robotframework-seleniumlibrary
-

Running this command installs also the latest Selenium and Robot Framework -versions, but you still need to install browser drivers separately. -The --upgrade option can be omitted when installing the library for the -first time.

-

It is possible to install directly from the GitHub repository. To install -latest source from the master branch, use this command:

-
pip install git+https://github.com/robotframework/SeleniumLibrary.git
-

Please note that installation will take some time, because pip will -clone the SeleniumLibrary project to a temporary directory and then -perform the installation.

-

See Robot Framework installation instructions for detailed information -about installing Python and Robot Framework itself. For more details about -using pip see its own documentation.

-
-
-

Browser drivers

-

After installing the library, you still need to install browser and -operating system specific browser drivers for all those browsers you -want to use in tests. These are the exact same drivers you need to use with -Selenium also when not using SeleniumLibrary. More information about -drivers can be found from Selenium documentation.

-

The general approach to install a browser driver is downloading a right -driver, such as chromedriver for Chrome, and placing it into -a directory that is in PATH. Drivers for different browsers -can be found via Selenium documentation or by using your favorite -search engine with a search term like selenium chrome browser driver. -New browser driver versions are released to support features in -new browsers, fix bug, or otherwise, and you need to keep an eye on them -to know when to update drivers you use.

-

Alternatively, you can use a tool called WebdriverManager which can -find the latest version or when required, any version of appropriate -webdrivers for you and then download and link/copy it into right -location. Tool can run on all major operating systems and supports -downloading of Chrome, Firefox, Opera & Edge webdrivers.

-

Here's an example:

-
pip install webdrivermanager
-webdrivermanager firefox chrome --linkpath /usr/local/bin
-
-
-

Usage

-

To use SeleniumLibrary in Robot Framework tests, the library needs to -first be imported using the Library setting as any other library. -The library accepts some import time arguments, which are documented -in the keyword documentation along with all the keywords provided -by the library.

-

When using Robot Framework, it is generally recommended to write as -easy-to-understand tests as possible. The keywords provided by -SeleniumLibrary is pretty low level, though, and often require -implementation-specific arguments like element locators to be passed -as arguments. It is thus typically a good idea to write tests using -Robot Framework's higher-level keywords that utilize SeleniumLibrary -keywords internally. This is illustrated by the following example -where SeleniumLibrary keywords like Input Text are primarily -used by higher-level keywords like Input Username.

-
*** Settings ***
-Documentation     Simple example using SeleniumLibrary.
-Library           SeleniumLibrary
-
-*** Variables ***
-${LOGIN URL}      http://localhost:7272
-${BROWSER}        Chrome
-
-*** Test Cases ***
-Valid Login
-    Open Browser To Login Page
-    Input Username    demo
-    Input Password    mode
-    Submit Credentials
-    Welcome Page Should Be Open
-    [Teardown]    Close Browser
-
-*** Keywords ***
-Open Browser To Login Page
-    Open Browser    ${LOGIN URL}    ${BROWSER}
-    Title Should Be    Login Page
-
-Input Username
-    [Arguments]    ${username}
-    Input Text    username_field    ${username}
-
-Input Password
-    [Arguments]    ${password}
-    Input Text    password_field    ${password}
-
-Submit Credentials
-    Click Button    login_button
-
-Welcome Page Should Be Open
-    Title Should Be    Welcome Page
-

The above example is a slightly modified version of an example in a -demo project that illustrates using Robot Framework and SeleniumLibrary. -See the demo for more examples that you can also execute on your own -machine. For more information about Robot Framework test data syntax in -general see the Robot Framework User Guide.

-
-
-

Extending SeleniumLibrary

-

Before creating your own library which extends the SeleniumLibrary, please consider would -the extension be also useful also for general usage. If it could be useful also for general -usage, please create a new issue describing the enhancement request and even better if the -issue is backed up by a pull request.

-

If the enhancement is not generally useful, example solution is domain specific, then the -SeleniumLibrary offers public APIs which can be used to build its own plugins and libraries. -Plugin API allows us to add new keywords, modify existing keywords and modify the internal -functionality of the library. Also new libraries can be built on top of the -SeleniumLibrary. Please see extending documentation for more details about the -available methods and for examples how the library can be extended.

-
-
-

Community

-

If the provided documentation is not enough, there are various community channels -available:

- -
-
- - + + + + + + +SeleniumLibrary + + + + +
+

SeleniumLibrary

+ + +
+

Introduction

+

SeleniumLibrary is a web testing library for Robot Framework that +utilizes the Selenium tool internally. The project is hosted on GitHub +and downloads can be found from PyPI.

+

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11. +In addition to the normal Python interpreter, it works also +with PyPy.

+

SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to +Selenium2Library and then later renamed back to SeleniumLibrary. +See the VERSIONS.rst for more information about different versions and the +overall project history.

+ +https://img.shields.io/pypi/v/robotframework-seleniumlibrary.svg?label=version + + +https://img.shields.io/pypi/dm/robotframework-seleniumlibrary.svg + + +https://img.shields.io/pypi/l/robotframework-seleniumlibrary.svg + + +https://github.com/robotframework/SeleniumLibrary/actions/workflows/CI.yml/badge.svg?branch=master + +
+
+

Keyword Documentation

+

See keyword documentation for available keywords and more information +about the library in general.

+
+
+

Installation

+

The recommended installation method is using pip:

+
pip install --upgrade robotframework-seleniumlibrary
+

Running this command installs also the latest Selenium and Robot Framework +versions, but you still need to install browser drivers separately. +The --upgrade option can be omitted when installing the library for the +first time.

+

It is possible to install directly from the GitHub repository. To install +latest source from the master branch, use this command:

+
pip install git+https://github.com/robotframework/SeleniumLibrary.git
+

Please note that installation will take some time, because pip will +clone the SeleniumLibrary project to a temporary directory and then +perform the installation.

+

See Robot Framework installation instructions for detailed information +about installing Python and Robot Framework itself. For more details about +using pip see its own documentation.

+
+
+

Browser drivers

+

After installing the library, you still need to install browser and +operating system specific browser drivers for all those browsers you +want to use in tests. These are the exact same drivers you need to use with +Selenium also when not using SeleniumLibrary. More information about +drivers can be found from Selenium documentation.

+

The general approach to install a browser driver is downloading a right +driver, such as chromedriver for Chrome, and placing it into +a directory that is in PATH. Drivers for different browsers +can be found via Selenium documentation or by using your favorite +search engine with a search term like selenium chrome browser driver. +New browser driver versions are released to support features in +new browsers, fix bug, or otherwise, and you need to keep an eye on them +to know when to update drivers you use.

+

Alternatively, you can use a tool called WebdriverManager which can +find the latest version or when required, any version of appropriate +webdrivers for you and then download and link/copy it into right +location. Tool can run on all major operating systems and supports +downloading of Chrome, Firefox, Opera & Edge webdrivers.

+

Here's an example:

+
pip install webdrivermanager
+webdrivermanager firefox chrome --linkpath /usr/local/bin
+
+
+

Usage

+

To use SeleniumLibrary in Robot Framework tests, the library needs to +first be imported using the Library setting as any other library. +The library accepts some import time arguments, which are documented +in the keyword documentation along with all the keywords provided +by the library.

+

When using Robot Framework, it is generally recommended to write as +easy-to-understand tests as possible. The keywords provided by +SeleniumLibrary is pretty low level, though, and often require +implementation-specific arguments like element locators to be passed +as arguments. It is thus typically a good idea to write tests using +Robot Framework's higher-level keywords that utilize SeleniumLibrary +keywords internally. This is illustrated by the following example +where SeleniumLibrary keywords like Input Text are primarily +used by higher-level keywords like Input Username.

+
*** Settings ***
+Documentation     Simple example using SeleniumLibrary.
+Library           SeleniumLibrary
+
+*** Variables ***
+${LOGIN URL}      http://localhost:7272
+${BROWSER}        Chrome
+
+*** Test Cases ***
+Valid Login
+    Open Browser To Login Page
+    Input Username    demo
+    Input Password    mode
+    Submit Credentials
+    Welcome Page Should Be Open
+    [Teardown]    Close Browser
+
+*** Keywords ***
+Open Browser To Login Page
+    Open Browser    ${LOGIN URL}    ${BROWSER}
+    Title Should Be    Login Page
+
+Input Username
+    [Arguments]    ${username}
+    Input Text    username_field    ${username}
+
+Input Password
+    [Arguments]    ${password}
+    Input Text    password_field    ${password}
+
+Submit Credentials
+    Click Button    login_button
+
+Welcome Page Should Be Open
+    Title Should Be    Welcome Page
+

The above example is a slightly modified version of an example in a +demo project that illustrates using Robot Framework and SeleniumLibrary. +See the demo for more examples that you can also execute on your own +machine. For more information about Robot Framework test data syntax in +general see the Robot Framework User Guide.

+
+
+

Extending SeleniumLibrary

+

Before creating your own library which extends the SeleniumLibrary, please consider would +the extension be also useful also for general usage. If it could be useful also for general +usage, please create a new issue describing the enhancement request and even better if the +issue is backed up by a pull request.

+

If the enhancement is not generally useful, example solution is domain specific, then the +SeleniumLibrary offers public APIs which can be used to build its own plugins and libraries. +Plugin API allows us to add new keywords, modify existing keywords and modify the internal +functionality of the library. Also new libraries can be built on top of the +SeleniumLibrary. Please see extending documentation for more details about the +available methods and for examples how the library can be extended.

+
+
+

Community

+

If the provided documentation is not enough, there are various community channels +available:

+ +
+
+ + From e8c16497be2ab1f19984266cbaea4732456dcb2e Mon Sep 17 00:00:00 2001 From: vs-sap <161034139+vs-sap@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:03:07 +0100 Subject: [PATCH 316/407] Remove unneeded 'send_' in docs --- src/SeleniumLibrary/keywords/element.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/element.py b/src/SeleniumLibrary/keywords/element.py index 131fadbf9..831ebfaf2 100644 --- a/src/SeleniumLibrary/keywords/element.py +++ b/src/SeleniumLibrary/keywords/element.py @@ -923,7 +923,6 @@ def press_key(self, locator: Union[WebElement, str], key: str): using the selenium send_keys method. Although one is not recommended over the other if `Press Key` does not work we recommend trying `Press Keys`. - send_ """ if key.startswith("\\") and len(key) > 1: key = self._map_ascii_key_code_to_key(int(key[1:])) From c52437b2452147b114fd10092c86fe520faf87bd Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 4 Sep 2024 22:12:43 -0400 Subject: [PATCH 317/407] Initial Python 3.12 support --- .github/workflows/CI.yml | 2 +- README.rst | 2 +- ..._options_string_errors_py3_12.approved.txt | 8 ++++++++ ..._service_string_errors_py3_12.approved.txt | 8 ++++++++ .../keywords/test_selenium_options_parser.py | 19 ++++++++++++++++--- .../keywords/test_selenium_service_parser.py | 19 ++++++++++++++++++- 6 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt create mode 100644 utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 8db0eff25..c5d2008d8 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.8, 3.11] # 3.12, pypy-3.9 + python-version: [3.8, 3.12] # 3.12, pypy-3.9 rf-version: [5.0.1, 6.1.1, 7.0] selenium-version: [4.20.0, 4.21.0] browser: [firefox, chrome, headlesschrome] #edge diff --git a/README.rst b/README.rst index 85819fcab..727c8e705 100644 --- a/README.rst +++ b/README.rst @@ -10,7 +10,7 @@ SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes the Selenium_ tool internally. The project is hosted on GitHub_ and downloads can be found from PyPI_. -SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.11. +SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.12. In addition to the normal Python_ interpreter, it works also with PyPy_. diff --git a/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt b/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt new file mode 100644 index 000000000..d57473c22 --- /dev/null +++ b/utest/test/keywords/approved_files/test_selenium_options_parser.test_parse_options_string_errors_py3_12.approved.txt @@ -0,0 +1,8 @@ +Selenium options string errors + +0) method("arg1) ('unterminated string literal (detected at line 1)', (1, 8)) +1) method(arg1") ('unterminated string literal (detected at line 1)', (1, 12)) +2) method(arg1) Unable to parse option: "method(arg1)" +3) attribute=arg1 Unable to parse option: "attribute=arg1" +4) attribute=webdriver Unable to parse option: "attribute=webdriver" +5) method(argument="value") Unable to parse option: "method(argument="value")" diff --git a/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt b/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt new file mode 100644 index 000000000..44dc032d0 --- /dev/null +++ b/utest/test/keywords/approved_files/test_selenium_service_parser.test_parse_service_string_errors_py3_12.approved.txt @@ -0,0 +1,8 @@ +Selenium service string errors + +0) attribute=arg1 Unable to parse service: "attribute=arg1" +1) attribute='arg1 ('unterminated string literal (detected at line 1)', (1, 11)) +2) attribute=['arg1' ('unexpected EOF in multi-line statement', (1, 0)) +3) attribute=['arg1';'arg2'] ('unexpected EOF in multi-line statement', (1, 0)) +4) attribute['arg1'] Unable to parse service: "attribute['arg1']" +5) attribute=['arg1'] attribute=['arg2'] Unable to parse service: "attribute=['arg1'] attribute=['arg2']" diff --git a/utest/test/keywords/test_selenium_options_parser.py b/utest/test/keywords/test_selenium_options_parser.py index 40e51bdd9..b61fff029 100644 --- a/utest/test/keywords/test_selenium_options_parser.py +++ b/utest/test/keywords/test_selenium_options_parser.py @@ -1,4 +1,5 @@ import os +import sys import unittest import pytest @@ -102,7 +103,8 @@ def test_parse_arguemnts(options, reporter): verify_all("Parse arguments from complex object", results, reporter=reporter) -@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12") def test_parse_options_string_errors(options, reporter): results = [] results.append(error_formatter(options._parse, 'method("arg1)', True)) @@ -114,6 +116,19 @@ def test_parse_options_string_errors(options, reporter): verify_all("Selenium options string errors", results, reporter=reporter) +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12") +def test_parse_options_string_errors_py3_12(options, reporter): + results = [] + results.append(error_formatter(options._parse, 'method("arg1)', True)) + results.append(error_formatter(options._parse, 'method(arg1")', True)) + results.append(error_formatter(options._parse, "method(arg1)", True)) + results.append(error_formatter(options._parse, "attribute=arg1", True)) + results.append(error_formatter(options._parse, "attribute=webdriver", True)) + results.append(error_formatter(options._parse, 'method(argument="value")', True)) + verify_all("Selenium options string errors", results, reporter=reporter) + + @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") def test_split_options(options, reporter): results = [] @@ -203,8 +218,6 @@ def output_dir(): output_dir = os.path.abspath(os.path.join(curr_dir, "..", "..", "output_dir")) return output_dir -from selenium.webdriver.chrome.service import Service as ChromeService - def test_create_chrome_with_options(creator): options = mock() diff --git a/utest/test/keywords/test_selenium_service_parser.py b/utest/test/keywords/test_selenium_service_parser.py index 637a208c6..095a8c2c2 100644 --- a/utest/test/keywords/test_selenium_service_parser.py +++ b/utest/test/keywords/test_selenium_service_parser.py @@ -1,4 +1,5 @@ import os +import sys import unittest import pytest @@ -53,7 +54,10 @@ def test_parse_service_string(service, reporter): verify_all("Selenium service string to dict", results, reporter=reporter) -@unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +# @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") +# @unittest.skipIf(sys.version_info > (3, 11), reason="Errors change with Python 3.12") +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info > (3, 11), reason="Errors change with Python 3.12") def test_parse_service_string_errors(service, reporter): results = [] results.append(error_formatter(service._parse, "attribute=arg1", True)) @@ -65,6 +69,19 @@ def test_parse_service_string_errors(service, reporter): verify_all("Selenium service string errors", results, reporter=reporter) +@pytest.mark.skipif(WINDOWS, reason="ApprovalTest do not support different line feeds") +@pytest.mark.skipif(sys.version_info < (3, 12), reason="Errors change with Python 3.12") +def test_parse_service_string_errors_py3_12(service, reporter): + results = [] + results.append(error_formatter(service._parse, "attribute=arg1", True)) + results.append(error_formatter(service._parse, "attribute='arg1", True)) + results.append(error_formatter(service._parse, "attribute=['arg1'", True)) + results.append(error_formatter(service._parse, "attribute=['arg1';'arg2']", True)) + results.append(error_formatter(service._parse, "attribute['arg1']", True)) + results.append(error_formatter(service._parse, "attribute=['arg1'] attribute=['arg2']", True)) + verify_all("Selenium service string errors", results, reporter=reporter) + + @unittest.skipIf(WINDOWS, reason="ApprovalTest do not support different line feeds") def test_split_service(service, reporter): results = [] From f263368af53eb8a7ded2b5754ab8fbbe18aa2064 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 5 Sep 2024 08:56:45 -0400 Subject: [PATCH 318/407] Triage atest "Should Detect Page Loads While Waiting On An Async Script And Return An Error" is showing some differences I believe with the current Chrome browser version 128. Going to temporarily triage it and see if there are other issues within the test matrix. --- atest/acceptance/keywords/async_javascript.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/async_javascript.robot b/atest/acceptance/keywords/async_javascript.robot index 7fc72b198..646e3dd16 100644 --- a/atest/acceptance/keywords/async_javascript.robot +++ b/atest/acceptance/keywords/async_javascript.robot @@ -88,6 +88,7 @@ Should Timeout If Script Does Not Invoke Callback With Long Timeout ... var callback = arguments[arguments.length - 1]; window.setTimeout(callback, 1500); Should Detect Page Loads While Waiting On An Async Script And Return An Error + [Tags] Triage Set Selenium Timeout 0.5 seconds ${status} ${error} Run Keyword And Ignore Error Execute Async Javascript ... window.location = 'javascript/dynamic'; From f3f41110389c34543fcf0dfbd492f632243ea10b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 5 Sep 2024 13:30:51 -0400 Subject: [PATCH 319/407] Updated tested against Robot Framework versions Removed 5.0.1 as it is not compatable with Python3.12 (which came in RF version 6.1). Also bumped 7.0 to 7.0.1. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c5d2008d8..4628a13a9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: python-version: [3.8, 3.12] # 3.12, pypy-3.9 - rf-version: [5.0.1, 6.1.1, 7.0] + rf-version: [6.1.1, 7.0.1] selenium-version: [4.20.0, 4.21.0] browser: [firefox, chrome, headlesschrome] #edge From ff8cfb6ac7742ff11dbf5183c460e94ea2f9c659 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 5 Sep 2024 13:55:50 -0400 Subject: [PATCH 320/407] Updated setup.py with 3.12 support - also cleaned up the github runner --- .github/workflows/CI.yml | 2 +- setup.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4628a13a9..d61836c57 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.8, 3.12] # 3.12, pypy-3.9 + python-version: [3.8, 3.12] # pypy-3.9 rf-version: [6.1.1, 7.0.1] selenium-version: [4.20.0, 4.21.0] browser: [firefox, chrome, headlesschrome] #edge diff --git a/setup.py b/setup.py index 8ddead98f..89d86d307 100755 --- a/setup.py +++ b/setup.py @@ -17,6 +17,7 @@ Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 +Programming Language :: Python :: 3.12 Programming Language :: Python :: 3 :: Only Topic :: Software Development :: Testing Framework :: Robot Framework @@ -41,7 +42,7 @@ keywords = 'robotframework testing testautomation selenium webdriver web', platforms = 'any', classifiers = CLASSIFIERS, - python_requires = '>=3.8, <3.12', + python_requires = '>=3.8, <=3.12', install_requires = REQUIREMENTS, package_dir = {'': 'src'}, packages = find_packages('src'), From 305b8f6e8654543ca019e8e54b2b77e4965f2ad9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 5 Sep 2024 14:05:29 -0400 Subject: [PATCH 321/407] Updated Selenium Python versions to latest As I did not keep up with the selenium version over the summer going to test from 4.21.0 to latest (4.24.0) --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index d61836c57..2d0bda6c9 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -11,7 +11,7 @@ jobs: matrix: python-version: [3.8, 3.12] # pypy-3.9 rf-version: [6.1.1, 7.0.1] - selenium-version: [4.20.0, 4.21.0] + selenium-version: [4.21.0, 4.22.0, 4.23.1, 4.24.0] browser: [firefox, chrome, headlesschrome] #edge steps: From 948332aa52ffd29ecb9fd55ff2e6420f92654014 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 5 Sep 2024 14:51:39 -0400 Subject: [PATCH 322/407] Updated the "Install drivers via selenium-manager" CI step As we now are only testing Selenium version 2.21 or greater I removed the check to see the correct method name for getting the binaries with Selenium Manage. --- .github/workflows/CI.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 2d0bda6c9..d24a0ba01 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -60,11 +60,7 @@ jobs: pip install -U --pre robotframework==${{ matrix.rf-version }} - name: Install drivers via selenium-manager run: | - if [[ ${{ matrix.selenium-version }} == '4.20.0' || ${{ matrix.selenium-version }} == '4.21.0' ]]; then - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') - else - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm.get_binary())}")') - fi + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') echo "$SELENIUM_MANAGER_EXE" echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" From 27450d96cfea92c9c426bf13b74685625f4d874b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 6 Sep 2024 15:23:57 -0400 Subject: [PATCH 323/407] Release notes for 6.6.0 --- docs/SeleniumLibrary-6.6.0.rst | 79 ++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 docs/SeleniumLibrary-6.6.0.rst diff --git a/docs/SeleniumLibrary-6.6.0.rst b/docs/SeleniumLibrary-6.6.0.rst new file mode 100644 index 000000000..5e0b74f42 --- /dev/null +++ b/docs/SeleniumLibrary-6.6.0.rst @@ -0,0 +1,79 @@ +===================== +SeleniumLibrary 6.6.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.6.0 is a new release which adds +Python 3.12 support. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.6.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.6.0 was released on Friday September 6, 2024. SeleniumLibrary supports +Python 3.8 through 3.12, Selenium 4.21.0 through 4.24.0 and +Robot Framework 6.1.1 and 7.0.1. + +*In addition this version of SeleniumLibrary has been tested against the upcoming Robot +Framework v7.1 release (using v7.1rc2) and was found compatible. We expect it to work +fine with the final release which should be coming out soon.* + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.6.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Support for Python 3.12 was added in this release. In addition we added Robot Framework 7.0.1 + while dropping 5.0.1 which did not officially support Python 3.12. In addition with the almost + monthly releases of Selenium we have caught up testing against and supporting Selenium versions + 4.21.0, 4.22.0, 4.23.1, and 4.24.0. (`#1906`_) + +Acknowledgements +================ + +- I want to thank grepwood, KotlinIsland, and Robin Mackaij for pushing support python 3.12 and + Yuri, Tatu and Lassi for reviewing the changes. (`#1906`_) + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1906`_ + - enhancement + - high + - Support python 3.12 + +Altogether 1 issue. View on the `issue tracker `__. + +.. _#1906: https://github.com/robotframework/SeleniumLibrary/issues/1906 From acd2b10b637e2913eac91c22944a3fbc3047a500 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 6 Sep 2024 15:24:47 -0400 Subject: [PATCH 324/407] Updated version to 6.6.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 1b2618941..1ac20b245 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -55,7 +55,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.5.0" +__version__ = "6.6.0" class SeleniumLibrary(DynamicCore): From 70139f3b88611317a34fd817d694d9aa4ab2796d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 6 Sep 2024 15:25:30 -0400 Subject: [PATCH 325/407] Generate stub file for 6.6.0 --- src/SeleniumLibrary/__init__.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.pyi b/src/SeleniumLibrary/__init__.pyi index d17efdd1c..45998d55a 100644 --- a/src/SeleniumLibrary/__init__.pyi +++ b/src/SeleniumLibrary/__init__.pyi @@ -107,7 +107,7 @@ class SeleniumLibrary: def mouse_out(self, locator: Union): ... def mouse_over(self, locator: Union): ... def mouse_up(self, locator: Union): ... - def open_browser(self, url: Optional[Optional] = None, browser: str = 'firefox', alias: Optional[Optional] = None, remote_url: Union = False, desired_capabilities: Optional[Union] = None, ff_profile_dir: Optional[Union] = None, options: Optional[Optional] = None, service_log_path: Optional[Optional] = None, executable_path: Optional[Optional] = None, service: Optional[Optional] = None): ... + def open_browser(self, url: Optional[Optional] = None, browser: str = 'firefox', alias: Optional[Optional] = None, remote_url: Union = False, desired_capabilities: Optional[Union] = None, ff_profile_dir: Optional[Union] = None, options: Optional[Any] = None, service_log_path: Optional[Optional] = None, executable_path: Optional[Optional] = None, service: Optional[Any] = None): ... def open_context_menu(self, locator: Union): ... def page_should_contain(self, text: str, loglevel: str = 'TRACE'): ... def page_should_contain_button(self, locator: Union, message: Optional[Optional] = None, loglevel: str = 'TRACE'): ... From 80e610146bd7f64c4f1efa3c686fc6b8ed1e352f Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 6 Sep 2024 15:25:59 -0400 Subject: [PATCH 326/407] Generated docs for version 6.6.0 --- docs/SeleniumLibrary.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index cf4ebe698..c88cb0cd9 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -7,7 +7,7 @@ - + + + + + + + + + + + + + + +
+

Opening library documentation failed

+
    +
  • Verify that you have JavaScript enabled in your browser.
  • +
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • +
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
+
+ + + + + + + + + + + + + + + + From 0c99a6d6728e4b59035dfcfafe5da6ae49d6e062 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Dec 2024 12:32:11 -0500 Subject: [PATCH 352/407] Regenerated project docs --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 7343120a3..3a9904b77 100644 --- a/docs/index.html +++ b/docs/index.html @@ -29,7 +29,7 @@

Introduction<

SeleniumLibrary is a web testing library for Robot Framework that utilizes the Selenium tool internally. The project is hosted on GitHub and downloads can be found from PyPI.

-

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.12. +

SeleniumLibrary currently works with Selenium 4. It supports Python 3.8 through 3.13. In addition to the normal Python interpreter, it works also with PyPy.

SeleniumLibrary is based on the "old SeleniumLibrary" that was forked to From 3fec008472b1cd845f3a63b129fba2fd96d2c627 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 6 Jan 2025 07:28:11 -0500 Subject: [PATCH 353/407] Release notes for 6.7.0 --- docs/SeleniumLibrary-6.7.0.rst | 106 +++++++++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 docs/SeleniumLibrary-6.7.0.rst diff --git a/docs/SeleniumLibrary-6.7.0.rst b/docs/SeleniumLibrary-6.7.0.rst new file mode 100644 index 000000000..f1bf8d778 --- /dev/null +++ b/docs/SeleniumLibrary-6.7.0.rst @@ -0,0 +1,106 @@ +===================== +SeleniumLibrary 6.7.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.7.0 is a new release with +some minor enhancements and bug fixes. This versions add support for Python 3.13. + + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.7.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.7.0 was released on Monday January 6, 2025. SeleniumLibrary supports +Python 3.8 through 3.13, Selenium 4.24.0 through 4.27.1 and +Robot Framework 6.1.1 and 7.1.1. + +*Note: This release, v 6.7.0, has been tested against the latest release candidate of the +upcoming Robot Framework version, 7.2. It is compatible and expect to support 7.2 when the +final release is made.* + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.7.0 + + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Fixed _find_by_data_locator when more than one colon was within the locator. If one + used the data strategy and the locator had additional colon in it the locator parser + would incorrectly parse the locator. This has been fixed in this release. (`#1924`_) +- Make SeleniumLibrary support one or more translations from same localisation project (`#1917`_) +- Support for Python version 3.13 + +Acknowledgements +================ + +We want to thank + +- `Markus Leben `_ for discovering, reporting, and fixing + the _find_by_data_locator issue (`#1924`_) +- `The Great Simo `_ and `Pavel `_ + for updating the requirements (`#1849`_) +- `iarmhi `_ for correcting an error the docs (`#1913`_) + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1924`_ + - bug + - high + - Fix _find_by_data_locator + * - `#1917`_ + - enhancement + - high + - Make SeleniumLibrary support one or more translation from same localisation project + * - `#1849`_ + - --- + - medium + - Update the rerequirements + * - `#1913`_ + - bug + - low + - Remove unneeded 'send_' in docs + * - `#1925`_ + - --- + - --- + - Latest Versions Oct2024 + +Altogether 5 issues. View on the `issue tracker `__. + +.. _#1924: https://github.com/robotframework/SeleniumLibrary/issues/1924 +.. _#1917: https://github.com/robotframework/SeleniumLibrary/issues/1917 +.. _#1849: https://github.com/robotframework/SeleniumLibrary/issues/1849 +.. _#1913: https://github.com/robotframework/SeleniumLibrary/issues/1913 +.. _#1925: https://github.com/robotframework/SeleniumLibrary/issues/1925 From af36f39bdc0a319167c731045e79d5784c1b27f7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 6 Jan 2025 07:28:39 -0500 Subject: [PATCH 354/407] Updated version to 6.7.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index a85e2bc8c..1228fb94e 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -55,7 +55,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.7.0rc1" +__version__ = "6.7.0" class SeleniumLibrary(DynamicCore): From 68b81495dc64fda6f5fa7a7359f199581404fd61 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 6 Jan 2025 07:29:54 -0500 Subject: [PATCH 355/407] Generated docs for version 6.7.0 --- docs/SeleniumLibrary.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 92c67b30f..2bd5eac76 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -7,7 +7,7 @@ - + - - - - - - - + - - - + +

Opening library documentation failed

  • Verify that you have JavaScript enabled in your browser.
  • -
  • Make sure you are using a modern enough browser. If using Internet Explorer, version 11 is required.
  • -
  • Check are there messages in your browser's JavaScript error log. Please report the problem if you suspect you have encountered a bug.
  • +
  • + Make sure you are using a modern enough browser. If using + Internet Explorer, version 11 is required. +
  • +
  • + Check are there messages in your browser's + JavaScript error log. Please report the problem if you suspect + you have encountered a bug. +
- - - + + + + +
+ - + + + + + + - + - - - + + - + + - - - - - + {{#if usages.length}} +
+

{{t "usages"}}

+
    + {{#each usages}} +
  • {{this}}
  • + {{/each}} +
+
+ {{/if}} +

+
+ + + From 15ce0966638cb3a2e7e22fa4cc7fd129030252d8 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Fri, 23 May 2025 10:50:47 -0400 Subject: [PATCH 363/407] Update README.rst 'Browser drivers' section --- README.rst | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) diff --git a/README.rst b/README.rst index efd83b3c4..1f4346024 100644 --- a/README.rst +++ b/README.rst @@ -44,8 +44,7 @@ The recommended installation method is using pip_:: pip install --upgrade robotframework-seleniumlibrary Running this command installs also the latest Selenium and Robot Framework -versions, but you still need to install `browser drivers`_ separately. -The ``--upgrade`` option can be omitted when installing the library for the +versions. The ``--upgrade`` option can be omitted when installing the library for the first time. It is possible to install directly from the GitHub_ repository. To install @@ -64,39 +63,11 @@ using ``pip`` see `its own documentation `__. Browser drivers --------------- -After installing the library, you still need to install browser and -operating system specific browser drivers for all those browsers you -want to use in tests. These are the exact same drivers you need to use with -Selenium also when not using SeleniumLibrary. More information about -drivers can be found from `Selenium documentation`__. - -The general approach to install a browser driver is downloading a right -driver, such as ``chromedriver`` for Chrome, and placing it into -a directory that is in PATH__. Drivers for different browsers -can be found via Selenium documentation or by using your favorite -search engine with a search term like ``selenium chrome browser driver``. -New browser driver versions are released to support features in -new browsers, fix bug, or otherwise, and you need to keep an eye on them -to know when to update drivers you use. - -Alternatively, you can use a tool called WebdriverManager__ which can -find the latest version or when required, any version of appropriate -webdrivers for you and then download and link/copy it into right -location. Tool can run on all major operating systems and supports -downloading of Chrome, Firefox, Opera & Edge webdrivers. - -Here's an example: - -.. code:: bash - - pip install webdrivermanager - webdrivermanager firefox chrome --linkpath /usr/local/bin - - +Browsers and drivers are installed and managed automatically by `Selenium Manager`__. +For more information, see the `Selenium documentation`__. +__ https://www.selenium.dev/documentation/selenium_manager __ https://seleniumhq.github.io/selenium/docs/api/py/index.html#drivers -__ https://en.wikipedia.org/wiki/PATH_(variable) -__ https://github.com/omenia/webdrivermanager Usage ----- From 1a6a2ba1e8f056767d521a97168927a6e651ef89 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 24 May 2025 16:08:31 -0400 Subject: [PATCH 364/407] Initial commit of screenshot return base64 string --- src/SeleniumLibrary/keywords/screenshot.py | 40 +++++++++++++--------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/SeleniumLibrary/keywords/screenshot.py b/src/SeleniumLibrary/keywords/screenshot.py index 8cd8dc299..68ab37db2 100644 --- a/src/SeleniumLibrary/keywords/screenshot.py +++ b/src/SeleniumLibrary/keywords/screenshot.py @@ -27,6 +27,8 @@ DEFAULT_FILENAME_PAGE = "selenium-screenshot-{index}.png" DEFAULT_FILENAME_ELEMENT = "selenium-element-screenshot-{index}.png" EMBED = "EMBED" +BASE64 = "BASE64" +EMBEDDED_OPTIONS = [EMBED, BASE64] DEFAULT_FILENAME_PDF = "selenium-page-{index}.pdf" @@ -111,8 +113,9 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str: if not self.drivers.current: self.info("Cannot capture screenshot because no browser is open.") return - if self._decide_embedded(filename): - return self._capture_page_screen_to_log() + is_embedded, method = self._decide_embedded(filename) + if is_embedded: + return self._capture_page_screen_to_log(method) return self._capture_page_screenshot_to_file(filename) def _capture_page_screenshot_to_file(self, filename): @@ -123,9 +126,11 @@ def _capture_page_screenshot_to_file(self, filename): self._embed_to_log_as_file(path, 800) return path - def _capture_page_screen_to_log(self): + def _capture_page_screen_to_log(self, return_val): screenshot_as_base64 = self.driver.get_screenshot_as_base64() - self._embed_to_log_as_base64(screenshot_as_base64, 800) + base64_str = self._embed_to_log_as_base64(screenshot_as_base64, 800) + if return_val == BASE64: + return_val base64_str return EMBED @keyword @@ -159,8 +164,9 @@ def capture_element_screenshot( ) return element = self.find_element(locator, required=True) - if self._decide_embedded(filename): - return self._capture_element_screen_to_log(element) + is_embedded, method = self._decide_embedded(filename) + if is_embedded: + return self._capture_element_screen_to_log(element, method) return self._capture_element_screenshot_to_file(element, filename) def _capture_element_screenshot_to_file(self, element, filename): @@ -171,8 +177,10 @@ def _capture_element_screenshot_to_file(self, element, filename): self._embed_to_log_as_file(path, 400) return path - def _capture_element_screen_to_log(self, element): - self._embed_to_log_as_base64(element.screenshot_as_base64, 400) + def _capture_element_screen_to_log(self, element, return_val): + base64_str = self._embed_to_log_as_base64(element.screenshot_as_base64, 400) + if return_val == BASE64: + return base64_str return EMBED @property @@ -184,20 +192,20 @@ def _screenshot_root_directory(self, value): self.ctx.screenshot_root_directory = value def _decide_embedded(self, filename): - filename = filename.lower() + filename = filename.upper() if ( filename == DEFAULT_FILENAME_PAGE - and self._screenshot_root_directory == EMBED + and self._screenshot_root_directory in EMBEDDED_OPTIONS ): - return True + return True, self._screenshot_root_directory if ( filename == DEFAULT_FILENAME_ELEMENT - and self._screenshot_root_directory == EMBED + and self._screenshot_root_directory in EMBEDDED_OPTIONS ): - return True - if filename == EMBED.lower(): - return True - return False + return True, self._screenshot_root_directory + if filename in EMBEDDED_OPTIONS: + return True, self._screenshot_root_directory + return False, None def _get_screenshot_path(self, filename): if self._screenshot_root_directory != EMBED: From 0f5cf9c2318a7e437a463b7093940e4efee3112e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 24 May 2025 19:51:26 -0400 Subject: [PATCH 365/407] Updated tests and fixed a couple issues - Updated unit test to look for a tuple - Fixed issue with code on return statement - Fixed issue with unit tests --- src/SeleniumLibrary/keywords/screenshot.py | 6 +++--- utest/test/keywords/test_screen_shot.py | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/SeleniumLibrary/keywords/screenshot.py b/src/SeleniumLibrary/keywords/screenshot.py index 68ab37db2..0289287d4 100644 --- a/src/SeleniumLibrary/keywords/screenshot.py +++ b/src/SeleniumLibrary/keywords/screenshot.py @@ -130,7 +130,7 @@ def _capture_page_screen_to_log(self, return_val): screenshot_as_base64 = self.driver.get_screenshot_as_base64() base64_str = self._embed_to_log_as_base64(screenshot_as_base64, 800) if return_val == BASE64: - return_val base64_str + return base64_str return EMBED @keyword @@ -194,12 +194,12 @@ def _screenshot_root_directory(self, value): def _decide_embedded(self, filename): filename = filename.upper() if ( - filename == DEFAULT_FILENAME_PAGE + filename == DEFAULT_FILENAME_PAGE.upper() and self._screenshot_root_directory in EMBEDDED_OPTIONS ): return True, self._screenshot_root_directory if ( - filename == DEFAULT_FILENAME_ELEMENT + filename == DEFAULT_FILENAME_ELEMENT.upper() and self._screenshot_root_directory in EMBEDDED_OPTIONS ): return True, self._screenshot_root_directory diff --git a/utest/test/keywords/test_screen_shot.py b/utest/test/keywords/test_screen_shot.py index a5cac9248..56b98258f 100644 --- a/utest/test/keywords/test_screen_shot.py +++ b/utest/test/keywords/test_screen_shot.py @@ -22,24 +22,24 @@ def teardown_function(): def test_defaults(screen_shot): - assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME) is False - assert screen_shot._decide_embedded(ELEMENT_FILE_NAME) is False + assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME) == (False, None) + assert screen_shot._decide_embedded(ELEMENT_FILE_NAME) == (False, None) def test_screen_shotdir_embeded(screen_shot): screen_shot.ctx.screenshot_root_directory = EMBED - assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME) is True - assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME.upper()) is True - assert screen_shot._decide_embedded(ELEMENT_FILE_NAME) is True - assert screen_shot._decide_embedded(ELEMENT_FILE_NAME.upper()) is True - assert screen_shot._decide_embedded("other.psn") is False + assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME) == (True, EMBED) + assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME.upper()) == (True, EMBED) + assert screen_shot._decide_embedded(ELEMENT_FILE_NAME) == (True, EMBED) + assert screen_shot._decide_embedded(ELEMENT_FILE_NAME.upper()) == (True, EMBED) + assert screen_shot._decide_embedded("other.psn") == (False, None) def test_file_name_embeded(screen_shot): - assert screen_shot._decide_embedded(EMBED) is True - assert screen_shot._decide_embedded("other.psn") is False + assert screen_shot._decide_embedded(EMBED) == (True, EMBED) + assert screen_shot._decide_embedded("other.psn") == (False, None) screen_shot.ctx.screenshot_root_directory = EMBED - assert screen_shot._decide_embedded(EMBED) is True + assert screen_shot._decide_embedded(EMBED) == (True, EMBED) def test_screenshot_path_embedded(screen_shot): From c87bb4544691d6f4ec6b56f26c3d70c32758b6f4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 25 May 2025 08:17:22 -0400 Subject: [PATCH 366/407] Added BASE64 to set screenshot directory keyword Forgot to add in the setting of the screenshot directory to handle BASE64 when not in all caps. --- src/SeleniumLibrary/keywords/screenshot.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/SeleniumLibrary/keywords/screenshot.py b/src/SeleniumLibrary/keywords/screenshot.py index 0289287d4..dc3812e7a 100644 --- a/src/SeleniumLibrary/keywords/screenshot.py +++ b/src/SeleniumLibrary/keywords/screenshot.py @@ -61,6 +61,8 @@ def set_screenshot_directory(self, path: Union[None, str]) -> str: path = None elif path.upper() == EMBED: path = EMBED + elif path.upper() == BASE64: + path = BASE64 else: path = os.path.abspath(path) self._create_directory(path) From b16e05e2c43f704ad7080fc6a622ff9179c4d46a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 25 May 2025 08:19:09 -0400 Subject: [PATCH 367/407] Added unit tests to check for BASE64 and proper handling There is a still an error when the library is initialized with something like `bASe64`. It is not setting it. From the code this looks like the unintended behavior. But then I don't understand why theother test case works when `EmBed` is given. This too should fail as per my reading of the code. Going to trace through a bit more to see why that isn't failing and what I may be missing. --- utest/test/keywords/test_screen_shot.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/utest/test/keywords/test_screen_shot.py b/utest/test/keywords/test_screen_shot.py index 56b98258f..2ea09cb30 100644 --- a/utest/test/keywords/test_screen_shot.py +++ b/utest/test/keywords/test_screen_shot.py @@ -8,7 +8,7 @@ SCREENSHOT_FILE_NAME = "selenium-screenshot-{index}.png" ELEMENT_FILE_NAME = "selenium-element-screenshot-{index}.png" EMBED = "EMBED" - +BASE64 = "BASE64" @pytest.fixture(scope="module") def screen_shot(): @@ -35,11 +35,21 @@ def test_screen_shotdir_embeded(screen_shot): assert screen_shot._decide_embedded("other.psn") == (False, None) +def test_screen_shotdir_return_base64(screen_shot): + screen_shot.ctx.screenshot_root_directory = BASE64 + assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME) == (True, BASE64) + assert screen_shot._decide_embedded(SCREENSHOT_FILE_NAME.upper()) == (True, BASE64) + assert screen_shot._decide_embedded(ELEMENT_FILE_NAME) == (True, BASE64) + assert screen_shot._decide_embedded(ELEMENT_FILE_NAME.upper()) == (True, BASE64) + assert screen_shot._decide_embedded("other.psn") == (False, None) + + def test_file_name_embeded(screen_shot): - assert screen_shot._decide_embedded(EMBED) == (True, EMBED) assert screen_shot._decide_embedded("other.psn") == (False, None) screen_shot.ctx.screenshot_root_directory = EMBED assert screen_shot._decide_embedded(EMBED) == (True, EMBED) + screen_shot.ctx.screenshot_root_directory = BASE64 + assert screen_shot._decide_embedded(BASE64) == (True, BASE64) def test_screenshot_path_embedded(screen_shot): @@ -56,6 +66,12 @@ def test_sl_init_embed(): sl = SeleniumLibrary(screenshot_root_directory=EMBED) assert sl.screenshot_root_directory == EMBED + sl = SeleniumLibrary(screenshot_root_directory="bAsE64") + assert sl.screenshot_root_directory == BASE64 + + sl = SeleniumLibrary(screenshot_root_directory=BASE64) + assert sl.screenshot_root_directory == BASE64 + def test_sl_init_not_embed(): sl = SeleniumLibrary(screenshot_root_directory=None) @@ -76,6 +92,9 @@ def test_sl_set_screenshot_directory(): sl.set_screenshot_directory(EMBED) assert sl.screenshot_root_directory == EMBED + sl.set_screenshot_directory(BASE64) + assert sl.screenshot_root_directory == BASE64 + sl.set_screenshot_directory("EEmBedD") assert "EEmBedD" in sl.screenshot_root_directory assert len("EEmBedD") < len(sl.screenshot_root_directory) From a8e823402cd7d25008350869fe3f7425e18b5d4b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 25 May 2025 20:15:55 -0400 Subject: [PATCH 368/407] Resolved issue with setting BASE64 on library initialization --- src/SeleniumLibrary/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 0187df611..82ee75e5d 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -50,7 +50,7 @@ WebDriverCache, WindowKeywords, ) -from SeleniumLibrary.keywords.screenshot import EMBED +from SeleniumLibrary.keywords.screenshot import EMBED, BASE64 from SeleniumLibrary.locators import ElementFinder from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay @@ -614,8 +614,8 @@ def __init__( - ``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. @@ -846,6 +846,8 @@ def _resolve_screenshot_root_directory(self): if is_string(screenshot_root_directory): if screenshot_root_directory.upper() == EMBED: self.screenshot_root_directory = EMBED + if screenshot_root_directory.upper() == BASE64: + self.screenshot_root_directory = BASE64 @staticmethod def _get_translation(language: Union[str, None]) -> Union[Path, None]: From 6858c22ba183eb2e1fc19c76dd6112b47d7d6d4a Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 25 May 2025 21:56:44 -0400 Subject: [PATCH 369/407] Added keyword documentation for BASE64 option for screenshots --- src/SeleniumLibrary/keywords/screenshot.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/SeleniumLibrary/keywords/screenshot.py b/src/SeleniumLibrary/keywords/screenshot.py index dc3812e7a..11308af85 100644 --- a/src/SeleniumLibrary/keywords/screenshot.py +++ b/src/SeleniumLibrary/keywords/screenshot.py @@ -83,7 +83,14 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str: If ``filename`` equals to EMBED (case insensitive), then screenshot is embedded as Base64 image to the log.html. In this case file is not - created in the filesystem. + created in the filesystem. If ``filename`` equals to BASE64 (case + insensitive), then the base64 string is returned and the screenshot + is embedded to the log. This allows one to reuse the image elsewhere + in the report. + + Example: + | ${ss}= | `Capture Page Screenshot` | BASE64 | + | Set Test Message | *HTML*Test Success

| Starting from SeleniumLibrary 1.8, if ``filename`` contains marker ``{index}``, it will be automatically replaced with an unique running @@ -93,9 +100,10 @@ def capture_page_screenshot(self, filename: str = DEFAULT_FILENAME_PAGE) -> str: format string syntax]. An absolute path to the created screenshot file is returned or if - ``filename`` equals to EMBED, word `EMBED` is returned. + ``filename`` equals to EMBED, word `EMBED` is returned. If ``filename`` + equals to BASE64, the base64 string containing the screenshot is returned. - Support for EMBED is new in SeleniumLibrary 4.2 + Support for BASE64 is new in SeleniumLibrary 6.8 Examples: | `Capture Page Screenshot` | | @@ -147,18 +155,24 @@ def capture_element_screenshot( See the `Locating elements` section for details about the locator syntax. - An absolute path to the created element screenshot is returned. + An absolute path to the created element screenshot is returned. If the ``filename`` + equals to BASE64 (case insensitive), then the base64 string is returned in addition + to the screenshot embedded to the log. See ``Capture Page Screenshot`` for more + information. Support for capturing the screenshot from an element has limited support among browser vendors. Please check the browser vendor driver documentation does the browser support capturing a screenshot from an element. New in SeleniumLibrary 3.3. Support for EMBED is new in SeleniumLibrary 4.2. + Support for BASE64 is new in SeleniumLibrary 6.8. Examples: | `Capture Element Screenshot` | id:image_id | | | `Capture Element Screenshot` | id:image_id | ${OUTPUTDIR}/id_image_id-1.png | | `Capture Element Screenshot` | id:image_id | EMBED | + | ${ess}= | `Capture Element Screenshot` | id:image_id | BASE64 | + """ if not self.drivers.current: self.info( From 7c04d02c8fe5c66a0d3f685229de20ec8273de81 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 15 Jun 2025 12:50:31 -0400 Subject: [PATCH 370/407] Updating selenium and robotframework versions we test against --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 41fa78502..77891d523 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,8 +10,8 @@ jobs: strategy: matrix: python-version: [3.8, 3.13.0] # pypy-3.9 - rf-version: [6.1.1, 7.1.1] - selenium-version: [4.24.0, 4.25.0, 4.26.1, 4.27.1] + rf-version: [6.1.1, 7.2.2 7.3] + selenium-version: [4.32.0 4.33.0] browser: [firefox, chrome, headlesschrome] #edge steps: From 42399b688969dfdec2051ab988172458ac93460d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 15 Jun 2025 13:05:10 -0400 Subject: [PATCH 371/407] Fixed required version syntax --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 77891d523..ac98f2065 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -10,8 +10,8 @@ jobs: strategy: matrix: python-version: [3.8, 3.13.0] # pypy-3.9 - rf-version: [6.1.1, 7.2.2 7.3] - selenium-version: [4.32.0 4.33.0] + rf-version: [6.1.1, 7.2.2, 7.3] + selenium-version: [4.32.0, 4.33.0] browser: [firefox, chrome, headlesschrome] #edge steps: From 0f550e035c172a732ab5f6106dac0f0b53defd06 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 15 Jun 2025 14:11:31 -0400 Subject: [PATCH 372/407] Bump lower Python version tested to 3.9 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index ac98f2065..a4e12bbc6 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.8, 3.13.0] # pypy-3.9 + python-version: [3.9, 3.13.0] # pypy-3.9 rf-version: [6.1.1, 7.2.2, 7.3] selenium-version: [4.32.0, 4.33.0] browser: [firefox, chrome, headlesschrome] #edge From 33135cf653db990ff7ed97d567c6a6e2d5b06fb2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 06:17:38 -0400 Subject: [PATCH 373/407] Updated expected error messages on a couple tests --- atest/acceptance/keywords/expected_conditions.robot | 2 +- atest/acceptance/keywords/run_on_failure.robot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/expected_conditions.robot b/atest/acceptance/keywords/expected_conditions.robot index 4fa40dbfe..0df219177 100644 --- a/atest/acceptance/keywords/expected_conditions.robot +++ b/atest/acceptance/keywords/expected_conditions.robot @@ -10,7 +10,7 @@ Wait For Expected Conditions One Argument Title Should Be Delayed Wait For Expected Condition Times out within set timeout - [Documentation] FAIL REGEXP: TimeoutException: Message: Expected Condition not met within set timeout of 0.3* + [Documentation] FAIL STARTS: TimeoutException: Message: Expected Condition not met within set timeout of 0.3 Title Should Be Original Click Element link=delayed change title Wait For Expected Condition title_is Delayed timeout=0.3 diff --git a/atest/acceptance/keywords/run_on_failure.robot b/atest/acceptance/keywords/run_on_failure.robot index 761d4feca..6843aaf86 100644 --- a/atest/acceptance/keywords/run_on_failure.robot +++ b/atest/acceptance/keywords/run_on_failure.robot @@ -67,7 +67,7 @@ Run on Failure Returns Previous Value Should Be Equal ${old} Log Title Run On Failure also fails - [Documentation] LOG 2.1 WARN Keyword 'Failure During Run On failure' could not be run on failure: Expected error. + [Documentation] LOG 2.1.2 WARN Keyword 'Failure During Run On failure' could not be run on failure: Expected error. Register Keyword to Run on Failure Failure During Run On failure Run Keyword And Expect Error ... ${FAILURE MESSAGE} From 38e784d7a2edaf9f65372d0290310500ae543e48 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 07:32:39 -0400 Subject: [PATCH 374/407] Trying out key value pairs on python version for more expressive matrix --- .github/workflows/CI.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a4e12bbc6..a33d175bd 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,17 +9,18 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.9, 3.13.0] # pypy-3.9 + # python-version: [3.9, 3.13.0] # pypy-3.9 + python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 rf-version: [6.1.1, 7.2.2, 7.3] selenium-version: [4.32.0, 4.33.0] browser: [firefox, chrome, headlesschrome] #edge steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }} + - name: Set up Python ${{ matrix.python-version.* }} with Robot Framework ${{ matrix.rf-version }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ matrix.python-version.* }} - name: Setup Chrome uses: browser-actions/setup-chrome@latest with: @@ -41,12 +42,12 @@ jobs: export DISPLAY=:99.0 Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 & - name: Install dependencies - if: matrix.python-version != 'pypy-3.7' + if: matrix.python-version.* != 'pypy-3.7' run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Install dependencies for pypy - if: matrix.python-version == 'pypy-3.9' + if: matrix.python-version.* == 'pypy-3.9' run: | python -m pip install --upgrade pip pip install -r requirements.txt @@ -64,19 +65,24 @@ jobs: echo "$SELENIUM_MANAGER_EXE" echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" - - name: Generate stub file for ${{ matrix.python-version }} - if: matrix.python-version != 'pypy-3.9' + - name: Generate stub file for ${{ matrix.python-version.* }} + if: matrix.python-version.* != 'pypy-3.9' run: | invoke gen-stub # Temporarily ignoring pypy execution - name: Run tests with headless Chrome and with PyPy - if: startsWith( matrix.python-version, 'pypy') == true + if: startsWith( matrix.python-version.*, 'pypy') == true run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome - - name: Run tests with ${{ matrix.browser }} if CPython - if: startsWith( matrix.python-version, 'pypy') == false + # - name: Run tests with ${{ matrix.browser }} if CPython + # if: startsWith( matrix.python-version, 'pypy') == false + # run: | + # xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} + + - name: Run tests with latest python + if: matrix.python-version == ${{ matrix.python.version.latest }} run: | xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} From 3f135fb350b36bd4fe9f2a8f94323d347d787dbc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 07:47:56 -0400 Subject: [PATCH 375/407] Limit test matrix to latest python version and latest rf version Also reveted back from expressive matrix options as I need to learn how to use key-value pairs within gh actions. --- .github/workflows/CI.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index a33d175bd..c69baffd3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,18 +9,18 @@ jobs: continue-on-error: true strategy: matrix: - # python-version: [3.9, 3.13.0] # pypy-3.9 - python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 - rf-version: [6.1.1, 7.2.2, 7.3] + python-version: [3.9, 3.13.0] # pypy-3.9 + # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 + rf-version: [6.1.1, 7.2.2, 7.3.1] selenium-version: [4.32.0, 4.33.0] browser: [firefox, chrome, headlesschrome] #edge steps: - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version.* }} with Robot Framework ${{ matrix.rf-version }} + - name: Set up Python ${{ matrix.python-version }} with Robot Framework ${{ matrix.rf-version }} uses: actions/setup-python@v5 with: - python-version: ${{ matrix.python-version.* }} + python-version: ${{ matrix.python-version }} - name: Setup Chrome uses: browser-actions/setup-chrome@latest with: @@ -42,12 +42,12 @@ jobs: export DISPLAY=:99.0 Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 & - name: Install dependencies - if: matrix.python-version.* != 'pypy-3.7' + if: matrix.python-version != 'pypy-3.7' run: | python -m pip install --upgrade pip pip install -r requirements-dev.txt - name: Install dependencies for pypy - if: matrix.python-version.* == 'pypy-3.9' + if: matrix.python-version == 'pypy-3.9' run: | python -m pip install --upgrade pip pip install -r requirements.txt @@ -65,14 +65,14 @@ jobs: echo "$SELENIUM_MANAGER_EXE" echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" echo "$WEBDRIVERPATH" - - name: Generate stub file for ${{ matrix.python-version.* }} - if: matrix.python-version.* != 'pypy-3.9' + - name: Generate stub file for ${{ matrix.python-version }} + if: matrix.python-version != 'pypy-3.9' run: | invoke gen-stub # Temporarily ignoring pypy execution - name: Run tests with headless Chrome and with PyPy - if: startsWith( matrix.python-version.*, 'pypy') == true + if: startsWith( matrix.python-version, 'pypy') == true run: | xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome @@ -81,8 +81,8 @@ jobs: # run: | # xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} - - name: Run tests with latest python - if: matrix.python-version == ${{ matrix.python.version.latest }} + - name: Run tests with latest python and latest robot framework + if: matrix.python-version == '3.13.0' && matrix.rf-version == '7.3.1' run: | xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} From b54e4bab7f5be8a240bbd7c5e962a3ccf7c72b93 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 08:27:23 -0400 Subject: [PATCH 376/407] Uniquely name the artifacts --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c69baffd3..5f414184e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -96,6 +96,6 @@ jobs: - uses: actions/upload-artifact@v4 if: failure() with: - name: SeleniumLibrary Test results + name: sl_$${{ matrix.python-version }}_$${{ matrix.rf-version }}_$${{ matrix.selenium-version }}_$${{ matrix.browser }} path: atest/zip_results overwrite: true \ No newline at end of file From 4f947454b113fdc89ff008192965f7f4fb35721e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 17:00:26 -0400 Subject: [PATCH 377/407] Try slight delay in mouse over test --- atest/acceptance/keywords/mouse.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/mouse.robot b/atest/acceptance/keywords/mouse.robot index 2c25035e0..52b8ea1df 100644 --- a/atest/acceptance/keywords/mouse.robot +++ b/atest/acceptance/keywords/mouse.robot @@ -8,6 +8,7 @@ Resource ../resource.robot Mouse Over [Tags] Known Issue Safari Mouse Over el_for_mouseover + Sleep 0.1secs Textfield Value Should Be el_for_mouseover mouseover el_for_mouseover Run Keyword And Expect Error ... Element with locator 'not_there' not found. From 46351bf926c7b5a7fdc66dfd3917d7e97a228ef9 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 19:53:45 -0400 Subject: [PATCH 378/407] Try slight delay in mouse over error test --- atest/acceptance/keywords/mouse.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/mouse.robot b/atest/acceptance/keywords/mouse.robot index 52b8ea1df..5aff5c109 100644 --- a/atest/acceptance/keywords/mouse.robot +++ b/atest/acceptance/keywords/mouse.robot @@ -17,6 +17,7 @@ Mouse Over Mouse Over Error [Tags] Known Issue Safari Mouse Over el_for_mouseover + Sleep 0.1secs Textfield Value Should Be el_for_mouseover mouseover el_for_mouseover Run Keyword And Expect Error ... Element with locator '鱼在天空中飞翔' not found. From 30df9442dcb2bec59f1a50343d0d6623bad1c1a1 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 20:38:08 -0400 Subject: [PATCH 379/407] Try slowing down tests a bit --- atest/acceptance/keywords/textfields.robot | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atest/acceptance/keywords/textfields.robot b/atest/acceptance/keywords/textfields.robot index 1fa6f4522..a5c879874 100644 --- a/atest/acceptance/keywords/textfields.robot +++ b/atest/acceptance/keywords/textfields.robot @@ -1,5 +1,5 @@ *** Settings *** -Test Setup Go To Page "forms/prefilled_email_form.html" +Test Setup Text Fields Test Suite Setup Resource ../resource.robot Force Tags Known Issue Internet Explorer @@ -75,3 +75,8 @@ Press Key Attempt Clear Element Text On Non-Editable Field Run Keyword And Expect Error * Clear Element Text can_send_email + +*** Keywords *** +Text Fields Test Suite Setup + Go To Page "forms/prefilled_email_form.html" + Set Selenium Speed 0.1secs \ No newline at end of file From 6780fbb94676dbec13a2822a225dd67f07f3b3c5 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 20:59:27 -0400 Subject: [PATCH 380/407] Trying RF verion 7.2.2 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 5f414184e..318d65aee 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -82,7 +82,7 @@ jobs: # xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} - name: Run tests with latest python and latest robot framework - if: matrix.python-version == '3.13.0' && matrix.rf-version == '7.3.1' + if: matrix.python-version == '3.13.0' && matrix.rf-version == '7.2.2' run: | xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} From 86ac810bf81df0530bd4f05c8cd50546f9d779ee Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Wed, 18 Jun 2025 21:12:43 -0400 Subject: [PATCH 381/407] Put back in previous selenium versions --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 318d65aee..b0a966083 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,7 +12,7 @@ jobs: python-version: [3.9, 3.13.0] # pypy-3.9 # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 rf-version: [6.1.1, 7.2.2, 7.3.1] - selenium-version: [4.32.0, 4.33.0] + selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0] browser: [firefox, chrome, headlesschrome] #edge steps: From f493acb1248c25ccbf6a49effcf5206003887c51 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 19 Jun 2025 09:05:48 -0400 Subject: [PATCH 382/407] Added install chromedriver along side of chrome --- .github/workflows/CI.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b0a966083..4e139279e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -25,6 +25,8 @@ jobs: uses: browser-actions/setup-chrome@latest with: chrome-version: latest + install-dependencies: true + install-chromedriver: true id: setup-chrome - run: | echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} From 52faa8612baf8fc6b6aa8e50ec36f7bfd116b5c7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 19 Jun 2025 09:22:13 -0400 Subject: [PATCH 383/407] Trying Chrome version 138 Also reduce test matrix for now and set setup-chrome action to v1 (as compared to @latest) --- .github/workflows/CI.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4e139279e..7f0d70143 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,11 +9,11 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.9, 3.13.0] # pypy-3.9 + python-version: [3.13.0] # 3.9 pypy-3.9 # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 - rf-version: [6.1.1, 7.2.2, 7.3.1] + rf-version: [7.2.2] # 6.1.1, 7.3.1 selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0] - browser: [firefox, chrome, headlesschrome] #edge + browser: [chrome] # firefox, chrome, headlesschrome, edge steps: - uses: actions/checkout@v4 @@ -22,9 +22,9 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Setup Chrome - uses: browser-actions/setup-chrome@latest + uses: browser-actions/setup-chrome@v1 with: - chrome-version: latest + chrome-version: 138 install-dependencies: true install-chromedriver: true id: setup-chrome From db74c43c500b04f03c9c7063fcc985aede4e5690 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Thu, 19 Jun 2025 09:33:14 -0400 Subject: [PATCH 384/407] Trying chrome version 137 .. Looks like the system has Chrome 1.37 already installed. This will setup chrome 137 somewhere but more importantly add the driver. Realizing I may need to rework how we setup the machine .. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7f0d70143..9d59ac27f 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Chrome uses: browser-actions/setup-chrome@v1 with: - chrome-version: 138 + chrome-version: 137 install-dependencies: true install-chromedriver: true id: setup-chrome From eeec4b5f03a3986bced4af2d17d04c4acaa76f90 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 09:02:23 -0400 Subject: [PATCH 385/407] Turn off Chrome password leak detector --- atest/acceptance/keywords/textfields.robot | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/atest/acceptance/keywords/textfields.robot b/atest/acceptance/keywords/textfields.robot index a5c879874..6c3a41a3e 100644 --- a/atest/acceptance/keywords/textfields.robot +++ b/atest/acceptance/keywords/textfields.robot @@ -1,5 +1,6 @@ *** Settings *** -Test Setup Text Fields Test Suite Setup +Suite Setup Open Browser To Start Page Disabling Chrome Leaked Password Detection +Test Setup Go To Page "forms/prefilled_email_form.html" Resource ../resource.robot Force Tags Known Issue Internet Explorer @@ -77,6 +78,8 @@ Attempt Clear Element Text On Non-Editable Field Run Keyword And Expect Error * Clear Element Text can_send_email *** Keywords *** -Text Fields Test Suite Setup - Go To Page "forms/prefilled_email_form.html" - Set Selenium Speed 0.1secs \ No newline at end of file + +Open Browser To Start Page Disabling Chrome Leaked Password Detection + [Arguments] ${alias}=${None} + Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL} + ... options=add_experimental_option("prefs", {"profile.password_manager_leak_detection": False}) alias=${alias} \ No newline at end of file From 8c9307b35cba6f9c0808b0c4f5599ac72c3de3f0 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 09:02:55 -0400 Subject: [PATCH 386/407] Tweak some timing on the alert tests --- atest/acceptance/keywords/alerts.robot | 1 + 1 file changed, 1 insertion(+) diff --git a/atest/acceptance/keywords/alerts.robot b/atest/acceptance/keywords/alerts.robot index bd6f0ecaf..01c6c9bdf 100644 --- a/atest/acceptance/keywords/alerts.robot +++ b/atest/acceptance/keywords/alerts.robot @@ -43,6 +43,7 @@ Handle Alert returns message Handle Alert with custom timeout Click Button Slow alert + Sleep 0.1s Handle Alert timeout=1s Click Button Slow alert Run Keyword And Expect Error From a8468c2579b5d5fc292e0e9c011a0d8b4bf876e3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 09:42:05 -0400 Subject: [PATCH 387/407] Trying to get v138 chromedriver .. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 9d59ac27f..7f0d70143 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -24,7 +24,7 @@ jobs: - name: Setup Chrome uses: browser-actions/setup-chrome@v1 with: - chrome-version: 137 + chrome-version: 138 install-dependencies: true install-chromedriver: true id: setup-chrome From 467edb7b4041c5e9e3bf2bf4ddf7dbd96968a8d0 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 10:56:52 -0400 Subject: [PATCH 388/407] Expanding out the version text matrix verifying we are still good across many versions --- .github/workflows/CI.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7f0d70143..df25eef2e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,9 +9,9 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.13.0] # 3.9 pypy-3.9 + python-version: [3.9.23, 3.13.5] # pypy-3.9 # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 - rf-version: [7.2.2] # 6.1.1, 7.3.1 + rf-version: [6.1.1, 7.3.2] selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0] browser: [chrome] # firefox, chrome, headlesschrome, edge From b1dd105dbefc34bf3afdd5494056ea6d66c288ec Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 11:16:58 -0400 Subject: [PATCH 389/407] Add latest selenium version 4.34.2 into test matrix --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index df25eef2e..c7ea56b17 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -12,7 +12,7 @@ jobs: python-version: [3.9.23, 3.13.5] # pypy-3.9 # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 rf-version: [6.1.1, 7.3.2] - selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0] + selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0, 4.34.2] browser: [chrome] # firefox, chrome, headlesschrome, edge steps: From 573b36dfd1820fe6c365685240962477369948da Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 14:32:04 -0400 Subject: [PATCH 390/407] Removed sleep and extended expected timeout. Previously the timeout was 1 sec and the alert was delayed 500ms. With a normal execution it seems that that 500ms diference is just not long enough to reasonably expect the alert to appear. In reviewing this test it was shown any delay was useful and the needed time for an alert to triggered and then recognized would need more than 500ms. --- atest/acceptance/keywords/alerts.robot | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/alerts.robot b/atest/acceptance/keywords/alerts.robot index 01c6c9bdf..fb18fdee5 100644 --- a/atest/acceptance/keywords/alerts.robot +++ b/atest/acceptance/keywords/alerts.robot @@ -43,8 +43,7 @@ Handle Alert returns message Handle Alert with custom timeout Click Button Slow alert - Sleep 0.1s - Handle Alert timeout=1s + Handle Alert timeout=2s Click Button Slow alert Run Keyword And Expect Error ... Alert not found in 1 millisecond. From 3c8ffe3a883564fac400f123e4ac323c52b8fc19 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 19:35:33 -0400 Subject: [PATCH 391/407] Corrected expected plugin doc with changes to screenshot embed --- ...luginDocumentation.test_parse_plugin_init_doc.approved.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt index 935242b1e..3d734ab87 100644 --- a/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt +++ b/utest/test/api/approved_files/PluginDocumentation.test_parse_plugin_init_doc.approved.txt @@ -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. From e361743a90f5c423bf78aef214153be03c84e3b7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 3 Aug 2025 19:37:05 -0400 Subject: [PATCH 392/407] Removed and replaced deprecated is_string method --- src/SeleniumLibrary/__init__.py | 3 +-- src/SeleniumLibrary/keywords/window.py | 4 ++-- src/SeleniumLibrary/locators/windowmanager.py | 11 +++++------ src/SeleniumLibrary/utils/__init__.py | 1 - src/SeleniumLibrary/utils/types.py | 4 ++-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 82ee75e5d..3994c1ccc 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -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 @@ -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: diff --git a/src/SeleniumLibrary/keywords/window.py b/src/SeleniumLibrary/keywords/window.py index 01feee1fe..f2b086223 100644 --- a/src/SeleniumLibrary/keywords/window.py +++ b/src/SeleniumLibrary/keywords/window.py @@ -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): @@ -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) diff --git a/src/SeleniumLibrary/locators/windowmanager.py b/src/SeleniumLibrary/locators/windowmanager.py index 1dcff9330..a785babbd 100644 --- a/src/SeleniumLibrary/locators/windowmanager.py +++ b/src/SeleniumLibrary/locators/windowmanager.py @@ -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") @@ -38,7 +37,7 @@ 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): @@ -46,7 +45,7 @@ def get_window_handles(self, browser): 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 @@ -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) @@ -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 diff --git a/src/SeleniumLibrary/utils/__init__.py b/src/SeleniumLibrary/utils/__init__.py index ccc4df2c6..68ba94e1b 100644 --- a/src/SeleniumLibrary/utils/__init__.py +++ b/src/SeleniumLibrary/utils/__init__.py @@ -20,7 +20,6 @@ from .types import ( is_falsy, is_noney, - is_string, is_truthy, WINDOWS, _convert_timeout, diff --git a/src/SeleniumLibrary/utils/types.py b/src/SeleniumLibrary/utils/types.py index 82a94ada5..181b0bf50 100644 --- a/src/SeleniumLibrary/utils/types.py +++ b/src/SeleniumLibrary/utils/types.py @@ -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: @@ -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): From fabb5d2b0a91d58023d67dd45c0db03156793177 Mon Sep 17 00:00:00 2001 From: antivirak <56031501+antivirak@users.noreply.github.com> Date: Mon, 8 Sep 2025 11:55:14 +0200 Subject: [PATCH 393/407] Fix typo in deprecation message --- src/SeleniumLibrary/keywords/browsermanagement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/keywords/browsermanagement.py b/src/SeleniumLibrary/keywords/browsermanagement.py index c8114d484..042d12d50 100644 --- a/src/SeleniumLibrary/keywords/browsermanagement.py +++ b/src/SeleniumLibrary/keywords/browsermanagement.py @@ -216,7 +216,7 @@ def open_browser( if service_log_path: self.warn("service_log_path is being deprecated. Please use service to configure log_output or equivalent service attribute.") if executable_path: - self.warn("exexcutable_path is being deprecated. Please use service to configure the driver's executable_path as per documentation.") + self.warn("executable_path is being deprecated. Please use service to configure the driver's executable_path as per documentation.") return self._make_new_browser( url, browser, From 6fe002a1921c9265e11429db70e2e5522a5140f4 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Fri, 3 Oct 2025 20:20:52 -0400 Subject: [PATCH 394/407] Allow python version 3.14 --- .github/workflows/CI.yml | 2 +- setup.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index c7ea56b17..1ba18d3db 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -9,7 +9,7 @@ jobs: continue-on-error: true strategy: matrix: - python-version: [3.9.23, 3.13.5] # pypy-3.9 + python-version: [3.9.23, 3.13.5, 3.14.0-rc.3] # pypy-3.9 # python-version: [{earliest: 3.9}, {latest: 3.13.0}] # pypy-3.9 rf-version: [6.1.1, 7.3.2] selenium-version: [4.28.1, 4.29.0, 4.30.0, 4.31.0, 4.32.0, 4.33.0, 4.34.2] diff --git a/setup.py b/setup.py index a60681d30..0faf6569a 100755 --- a/setup.py +++ b/setup.py @@ -19,6 +19,7 @@ Programming Language :: Python :: 3.11 Programming Language :: Python :: 3.12 Programming Language :: Python :: 3.13 +Programming Language :: Python :: 3.14 Programming Language :: Python :: 3 :: Only Topic :: Software Development :: Testing Framework :: Robot Framework @@ -43,7 +44,7 @@ keywords = 'robotframework testing testautomation selenium webdriver web', platforms = 'any', classifiers = CLASSIFIERS, - python_requires = '>=3.8, <3.14', + python_requires = '>=3.8', install_requires = REQUIREMENTS, package_dir = {'': 'src'}, packages = find_packages('src'), From 1b9cc1ea3e76762d053cb4a295094c965547cdcc Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 4 Oct 2025 09:26:18 -0400 Subject: [PATCH 395/407] Release notes for 6.8.0 --- docs/SeleniumLibrary-6.8.0.rst | 111 +++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 docs/SeleniumLibrary-6.8.0.rst diff --git a/docs/SeleniumLibrary-6.8.0.rst b/docs/SeleniumLibrary-6.8.0.rst new file mode 100644 index 000000000..68ee911f9 --- /dev/null +++ b/docs/SeleniumLibrary-6.8.0.rst @@ -0,0 +1,111 @@ +===================== +SeleniumLibrary 6.8.0 +===================== + + +.. default-role:: code + + +SeleniumLibrary_ is a web testing library for `Robot Framework`_ that utilizes +the Selenium_ tool internally. SeleniumLibrary 6.8.0 is a new release with +screenshot enhancements and minor bug and documentation fixes. This version +adds support for Python 3.14. + +If you have pip_ installed, just run + +:: + + pip install --upgrade robotframework-seleniumlibrary + +to install the latest available release or use + +:: + + pip install robotframework-seleniumlibrary==6.8.0 + +to install exactly this version. Alternatively you can download the source +distribution from PyPI_ and install it manually. + +SeleniumLibrary 6.8.0 was released on Saturday October 4, 2025. SeleniumLibrary supports +Python 3.8 through 3.14, Selenium 4.28.1 through 4.34.2 and +Robot Framework 6.1.1 and 7.3.2. + +.. _Robot Framework: http://robotframework.org +.. _SeleniumLibrary: https://github.com/robotframework/SeleniumLibrary +.. _Selenium: http://seleniumhq.org +.. _pip: http://pip-installer.org +.. _PyPI: https://pypi.python.org/pypi/robotframework-seleniumlibrary +.. _issue tracker: https://github.com/robotframework/SeleniumLibrary/issues?q=milestone%3Av6.8.0 +.. _Selenium Documentation: https://www.selenium.dev/documentation/selenium_manager/ + +.. contents:: + :depth: 2 + :local: + +Most important enhancements +=========================== + +- Option to return embed screenshot while using Capture Page Screenshot (`#1923`_). + One is now given the additional option to return the screenshot as base64 string to be used + elsewhere in the log html. If the screenshot root directory is specified as `BASE64` + then the screenshot string is returned. See the `Capture Page Screenshot` keyword doc + for more information and example to place returned image in the log file. +- Update README.rst 'Browser drivers' section (`#1938`_) + With the (long past) addition of Selenium Manager within the selenium package, the documentation + on browser drivers was outdated and incorrect. This works to correct that. For more + information about Selenium Manager and handling browsers and drivers see the + `Selenium Documentation`_ on the topic. +- Loosen restriction on the upper Python version allowing Python 3.14 (`#1949`_) + +Acknowledgements +================ + +I want to thank the following people for helping getting out this release .. + +- `Hrutvik Jagtap `_ and `Shiva Prasad Adirala `_ + for contributing to the base64 image screenshot functionality (`#1923`_) +- `Corey Goldberg `_ for updating the README concerning Selenium Manager (`#1938`_) +- `DetachHead `_ for reporting the deprecated `is_string` error messages (`#1940`_) +- `Rudolf `_ for pushing for the addition of Python 3.14 (`#1949`_) + +I also want to thank `Yuri Verweij `_, `Lassi Heikkinen `_, +and `Tatu Aalto `_ for their ongoing contributions and support. + +Full list of fixes and enhancements +=================================== + +.. list-table:: + :header-rows: 1 + + * - ID + - Type + - Priority + - Summary + * - `#1923`_ + - enhancement + - high + - Return base64 image in case of EMBED + * - `#1938`_ + - enhancement + - high + - Update README.rst 'Browser drivers' section + * - `#1940`_ + - enhancement + - high + - remove usages of deprecated `is_string` + * - `#1949`_ + - enhancement + - high + - Python 3.14 + * - `#1939`_ + - --- + - --- + - Return screenshot as base64 string and embed into log + +Altogether 5 issues. View on the `issue tracker `__. + +.. _#1923: https://github.com/robotframework/SeleniumLibrary/issues/1923 +.. _#1938: https://github.com/robotframework/SeleniumLibrary/issues/1938 +.. _#1940: https://github.com/robotframework/SeleniumLibrary/issues/1940 +.. _#1949: https://github.com/robotframework/SeleniumLibrary/issues/1949 +.. _#1939: https://github.com/robotframework/SeleniumLibrary/issues/1939 From d2551fb282416ee21aa49c3ad566609d1c027118 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 4 Oct 2025 09:26:52 -0400 Subject: [PATCH 396/407] Updated version to 6.8.0 --- src/SeleniumLibrary/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SeleniumLibrary/__init__.py b/src/SeleniumLibrary/__init__.py index 3994c1ccc..6945eae7f 100644 --- a/src/SeleniumLibrary/__init__.py +++ b/src/SeleniumLibrary/__init__.py @@ -54,7 +54,7 @@ from SeleniumLibrary.utils import LibraryListener, is_truthy, _convert_timeout, _convert_delay -__version__ = "6.7.1" +__version__ = "6.8.0" class SeleniumLibrary(DynamicCore): From de2a7ceee4e65c2d8039f1fa87c79b94001966a3 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 4 Oct 2025 09:28:24 -0400 Subject: [PATCH 397/407] Generated docs for version 6.8.0 --- docs/SeleniumLibrary.html | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/SeleniumLibrary.html b/docs/SeleniumLibrary.html index 4d6abc3b6..be91c949a 100644 --- a/docs/SeleniumLibrary.html +++ b/docs/SeleniumLibrary.html @@ -9,7 +9,7 @@ - +

@@ -358,7 +358,7 @@

{{t "allowedValues"}}

{{else}} - {{# if items}} + {{#if items}}

{{t "dictStructure"}}

@@ -371,8 +371,8 @@

{{t "dictStructure"}}

{{else}} class="td-item" {{/if}} - >'${key}': - <${type}> + >'{{key}}': + <{{type}}> {{/each}}
}
@@ -412,9 +412,9 @@

{{t "usages"}}

{{generated}}.

- + data-v-2754030d="" fill="var(--text-color)">`,t.classList.add("modal-close-button");let r=document.createElement("div");r.classList.add("modal-close-button-container"),r.appendChild(t),t.addEventListener("click",()=>{rd()}),e.appendChild(r),r.addEventListener("click",()=>{rd()});let n=document.createElement("div");n.id="modal",n.classList.add("modal"),n.addEventListener("click",({target:e})=>{"A"===e.tagName.toUpperCase()&&rd()});let o=document.createElement("div");o.id="modal-content",o.classList.add("modal-content"),n.appendChild(o),e.appendChild(n),document.body.appendChild(e),document.addEventListener("keydown",({key:e})=>{"Escape"===e&&rd()})}()}renderTemplates(){this.renderLibdocTemplate("base",this.libdoc,"#root"),this.renderImporting(),this.renderShortcuts(),this.renderKeywords(),this.renderLibdocTemplate("data-types"),document.querySelectorAll(".dtdoc pre, .kwdoc pre").forEach(e=>{e.textContent=e.textContent.split("\n").map(e=>e.trim()).join("\n")}),this.renderLibdocTemplate("footer")}initHashEvents(){window.addEventListener("hashchange",function(){document.getElementsByClassName("hamburger-menu")[0].checked=!1},!1),window.addEventListener("hashchange",function(){if(0==window.location.hash.indexOf("#type-")){let e="#type-modal-"+decodeURI(window.location.hash.slice(6)),t=document.querySelector(".data-types").querySelector(e);t&&rp(t)}},!1),this.scrollToHash()}initTagSearch(){let e=new URLSearchParams(window.location.search),t="";e.has("tag")&&(t=e.get("tag"),this.tagSearch(t,window.location.hash)),this.libdoc.tags.length&&(this.libdoc.selectedTag=t,this.renderLibdocTemplate("tags-shortcuts"),document.getElementById("tags-shortcuts-container").onchange=e=>{let t=e.target.selectedOptions[0].value;""!=t?this.tagSearch(t):this.clearTagSearch()})}initLanguageMenu(){this.renderTemplate("language",{languages:this.translations.getLanguageCodes()}),document.querySelectorAll("#language-container ul a").forEach(e=>{e.innerHTML===this.translations.currentLanguage()&&e.classList.toggle("selected"),e.addEventListener("click",()=>{this.translations.setLanguage(e.innerHTML)&&this.render()})}),document.querySelector("#language-container button").addEventListener("click",()=>{document.querySelector("#language-container ul").classList.toggle("hidden")})}renderImporting(){this.renderLibdocTemplate("importing"),this.registerTypeDocHandlers("#importing-container")}renderShortcuts(){this.renderLibdocTemplate("shortcuts"),document.getElementById("toggle-keyword-shortcuts").addEventListener("click",()=>this.toggleShortcuts()),document.querySelector(".clear-search").addEventListener("click",()=>this.clearSearch()),document.querySelector(".search-input").addEventListener("keydown",()=>rf(()=>this.searching(),150)),this.renderLibdocTemplate("keyword-shortcuts"),document.querySelectorAll("a.match").forEach(e=>e.addEventListener("click",this.closeMenu))}registerTypeDocHandlers(e){document.querySelectorAll(`${e} a.type`).forEach(e=>e.addEventListener("click",e=>{let t=e.target.dataset.typedoc;rp(document.querySelector(`#type-modal-${t}`))}))}renderKeywords(e=null){null==e&&(e=this.libdoc),this.renderLibdocTemplate("keywords",e),document.querySelectorAll(".kw-tags span").forEach(e=>{e.addEventListener("click",e=>{this.tagSearch(e.target.innerText)})}),this.registerTypeDocHandlers("#keywords-container"),document.getElementById("keyword-statistics-header").innerText=""+this.libdoc.keywords.length}setTheme(){document.documentElement.setAttribute("data-theme",this.getTheme())}getTheme(){return null!=this.libdoc.theme?this.libdoc.theme:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}scrollToHash(){if(window.location.hash){let e=window.location.hash.substring(1),t=document.getElementById(decodeURIComponent(e));null!=t&&t.scrollIntoView()}}tagSearch(e,t){document.getElementsByClassName("search-input")[0].value="";let r={tags:!0,tagsExact:!0},n=window.location.pathname+"?tag="+e+(t||"");this.markMatches(e,r),this.highlightMatches(e,r),history.replaceState&&history.replaceState(null,"",n),document.getElementById("keyword-shortcuts-container").scrollTop=0}clearTagSearch(){document.getElementsByClassName("search-input")[0].value="",history.replaceState&&history.replaceState(null,"",window.location.pathname),this.resetKeywords()}searching(){this.searchTime=Date.now();let e=document.getElementsByClassName("search-input")[0].value,t={name:!0,args:!0,doc:!0,tags:!0};e?requestAnimationFrame(()=>{this.markMatches(e,t,this.searchTime,()=>{this.highlightMatches(e,t,this.searchTime),document.getElementById("keyword-shortcuts-container").scrollTop=0})}):this.resetKeywords()}highlightMatches(e,t,n){if(n&&n!==this.searchTime)return;let o=document.querySelectorAll("#shortcuts-container .match"),i=document.querySelectorAll("#keywords-container .match");if(t.name&&(new(r(eb))(o).mark(e),new(r(eb))(i).mark(e)),t.args&&new(r(eb))(document.querySelectorAll("#keywords-container .match .args")).mark(e),t.doc&&new(r(eb))(document.querySelectorAll("#keywords-container .match .doc")).mark(e),t.tags){let n=document.querySelectorAll("#keywords-container .match .tags a, #tags-shortcuts-container .match .tags a");if(t.tagsExact){let t=[];n.forEach(r=>{r.textContent?.toUpperCase()==e.toUpperCase()&&t.push(r)}),new(r(eb))(t).mark(e)}else new(r(eb))(n).mark(e)}}markMatches(e,t,r,n){if(r&&r!==this.searchTime)return;let o=e.replace(/[-[\]{}()+?*.,\\^$|#]/g,"\\$&");t.tagsExact&&(o="^"+o+"$");let i=RegExp(o,"i"),a=i.test.bind(i),s={},l=0;s.keywords=this.libdoc.keywords.map(e=>{let r={...e};return r.hidden=!(t.name&&a(r.name))&&!(t.args&&a(r.args))&&!(t.doc&&a(r.doc))&&!(t.tags&&r.tags.some(a)),!r.hidden&&l++,r}),this.renderLibdocTemplate("keyword-shortcuts",s),this.renderKeywords(s),this.libdoc.tags.length&&(this.libdoc.selectedTag=t.tagsExact?e:"",this.renderLibdocTemplate("tags-shortcuts")),document.getElementById("keyword-statistics-header").innerText=l+" / "+s.keywords.length,0===l&&(document.querySelector("#keywords-container table").innerHTML=""),n&&requestAnimationFrame(n)}closeMenu(){document.getElementById("hamburger-menu-input").checked=!1}openKeywordWall(){document.getElementsByClassName("shortcuts")[0].classList.add("keyword-wall"),this.storage.set("keyword-wall","open"),document.getElementById("toggle-keyword-shortcuts").innerText="-"}closeKeywordWall(){document.getElementsByClassName("shortcuts")[0].classList.remove("keyword-wall"),this.storage.set("keyword-wall","close"),document.getElementById("toggle-keyword-shortcuts").innerText="+"}toggleShortcuts(){document.getElementsByClassName("shortcuts")[0].classList.contains("keyword-wall")?this.closeKeywordWall():this.openKeywordWall()}resetKeywords(){this.renderLibdocTemplate("keyword-shortcuts"),this.renderKeywords(),this.libdoc.tags.length&&(this.libdoc.selectedTag="",this.renderLibdocTemplate("tags-shortcuts")),history.replaceState&&history.replaceState(null,"",location.pathname)}clearSearch(){document.getElementsByClassName("search-input")[0].value="";let e=document.getElementById("tags-shortcuts-container");e&&(e.selectedIndex=0),this.resetKeywords()}renderLibdocTemplate(e,t=null,r=""){null==t&&(t=this.libdoc),this.renderTemplate(e,t,r)}renderTemplate(e,t,n=""){let o=document.getElementById(`${e}-template`)?.innerHTML,i=r(ew).compile(o);""===n&&(n=`#${e}-container`),document.body.querySelector(n).innerHTML=i(t)}};!function(e){let t=new ek("libdoc"),r=eS.getInstance(e.lang);new rg(e,t,r).render()}(libdoc); From c5c21ea2eb44d7e76619f96210d1f28c859f3aee Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sat, 4 Oct 2025 09:29:30 -0400 Subject: [PATCH 398/407] Regenerated project docs --- docs/index.html | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/docs/index.html b/docs/index.html index 3a9904b77..128edf2fa 100644 --- a/docs/index.html +++ b/docs/index.html @@ -59,8 +59,7 @@

Installation<

The recommended installation method is using pip:

pip install --upgrade robotframework-seleniumlibrary

Running this command installs also the latest Selenium and Robot Framework -versions, but you still need to install browser drivers separately. -The --upgrade option can be omitted when installing the library for the +versions. The --upgrade option can be omitted when installing the library for the first time.

It is possible to install directly from the GitHub repository. To install latest source from the master branch, use this command:

@@ -74,27 +73,8 @@

Installation<

Browser drivers

-

After installing the library, you still need to install browser and -operating system specific browser drivers for all those browsers you -want to use in tests. These are the exact same drivers you need to use with -Selenium also when not using SeleniumLibrary. More information about -drivers can be found from Selenium documentation.

-

The general approach to install a browser driver is downloading a right -driver, such as chromedriver for Chrome, and placing it into -a directory that is in PATH. Drivers for different browsers -can be found via Selenium documentation or by using your favorite -search engine with a search term like selenium chrome browser driver. -New browser driver versions are released to support features in -new browsers, fix bug, or otherwise, and you need to keep an eye on them -to know when to update drivers you use.

-

Alternatively, you can use a tool called WebdriverManager which can -find the latest version or when required, any version of appropriate -webdrivers for you and then download and link/copy it into right -location. Tool can run on all major operating systems and supports -downloading of Chrome, Firefox, Opera & Edge webdrivers.

-

Here's an example:

-
pip install webdrivermanager
-webdrivermanager firefox chrome --linkpath /usr/local/bin
+

Browsers and drivers are installed and managed automatically by Selenium Manager. +For more information, see the Selenium documentation.

Usage

From e480b5d8eb35e14c365fd971b84ecd5c3d7b2ffb Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 13:32:32 -0500 Subject: [PATCH 399/407] Creating new GA workflow --- .github/workflows/Select.yml | 80 ++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/Select.yml diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml new file mode 100644 index 000000000..468cac733 --- /dev/null +++ b/.github/workflows/Select.yml @@ -0,0 +1,80 @@ +name: Select Configurations + +on: workflow_dispatch + +jobs: + test_config: + runs-on: ubuntu-latest + strategy: + matrix: + config: + - description: latest + python-version: 3.13.10 + rf-version: 7.4.1 + selenium-version: 4.39.0 + browser: chrome + - description: previous + python-version: 3.12.12 + rf-version: 7.3.2 + selenium-version: 4.38.0 + browser: firefox + + steps: + - uses: actions/checkout@v4 + - name: Configuration Description + run: | + echo "${{ matrix.config.description }} configuration" + echo "Testing with RF v${{ matrix.config.rf-version }}, Selenium v${{ matrix.config.selenium-version}}, Python v${{ matrix.config.python-version }} under ${{ matrix.config.browser }}" + - name: Set up Python ${{ matrix.config.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.config.python-version }} + - name: Setup ${{ matrix.config.browser }} browser + uses: browser-actions/setup-chrome@v1 + with: + chrome-version: 138 + install-dependencies: true + install-chromedriver: true + id: setup-chrome + - run: | + echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} + ${{ steps.setup-chrome.outputs.chrome-path }} --version + - name: Setup firefox + id: setup-firefox + uses: browser-actions/setup-firefox@v1 + with: + firefox-version: latest + - run: | + echo Installed firefox versions: ${{ steps.setup-firefox.outputs.firefox-version }} + ${{ steps.setup-firefox.outputs.firefox-path }} --version + - name: Start xvfb + run: | + export DISPLAY=:99.0 + Xvfb -ac :99 -screen 0 1280x1024x16 > /dev/null 2>&1 & + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements-dev.txt + - name: Install Seleninum v${{ matrix.config.selenium-version }} + run: | + pip install --upgrade selenium==${{ matrix.config.selenium-version }} + - name: Install RF ${{ matrix.config.rf-version }} + run: | + pip install -U --pre robotframework==${{ matrix.config.rf-version }} + - name: Install drivers via selenium-manager + run: | + SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') + echo "$SELENIUM_MANAGER_EXE" + echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" + echo "$WEBDRIVERPATH" + + - name: Run tests under specified config + run: | + xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} + + - uses: actions/upload-artifact@v4 + if: failure() + with: + name: sl_$${{ matrix.config.python-version }}_$${{ matrix.config.rf-version }}_$${{ matrix.config.selenium-version }}_$${{ matrix.config.browser }} + path: atest/zip_results + overwrite: true \ No newline at end of file From 1bc10b16a878f37b29965e002344db58ede3b53d Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 15:42:44 -0500 Subject: [PATCH 400/407] Fixed browser variable --- .github/workflows/Select.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml index 468cac733..dcc02d7f4 100644 --- a/.github/workflows/Select.yml +++ b/.github/workflows/Select.yml @@ -70,7 +70,7 @@ jobs: - name: Run tests under specified config run: | - xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.browser }} + xvfb-run --auto-servernum python atest/run.py --zip ${{ matrix.config.browser }} - uses: actions/upload-artifact@v4 if: failure() From 01e2001c1c6169848ee085b4349cbc4a5414ca36 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 16:30:26 -0500 Subject: [PATCH 401/407] Made a few changes to the select ci workflow - Added continuie on error - switched browser on "previous" config to chrome - change setup chrome version to latest --- .github/workflows/Select.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml index dcc02d7f4..8269134f3 100644 --- a/.github/workflows/Select.yml +++ b/.github/workflows/Select.yml @@ -5,6 +5,7 @@ on: workflow_dispatch jobs: test_config: runs-on: ubuntu-latest + continue-on-error: true strategy: matrix: config: @@ -17,7 +18,7 @@ jobs: python-version: 3.12.12 rf-version: 7.3.2 selenium-version: 4.38.0 - browser: firefox + browser: chrome steps: - uses: actions/checkout@v4 @@ -32,7 +33,7 @@ jobs: - name: Setup ${{ matrix.config.browser }} browser uses: browser-actions/setup-chrome@v1 with: - chrome-version: 138 + chrome-version: latest install-dependencies: true install-chromedriver: true id: setup-chrome From 9da83d39298902e4a521ed18e4bae023988d98db Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 16:55:02 -0500 Subject: [PATCH 402/407] Removed install drivers step .. --- .github/workflows/Select.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml index 8269134f3..04cc63ecd 100644 --- a/.github/workflows/Select.yml +++ b/.github/workflows/Select.yml @@ -62,12 +62,6 @@ jobs: - name: Install RF ${{ matrix.config.rf-version }} run: | pip install -U --pre robotframework==${{ matrix.config.rf-version }} - - name: Install drivers via selenium-manager - run: | - SELENIUM_MANAGER_EXE=$(python -c 'from selenium.webdriver.common.selenium_manager import SeleniumManager; sm=SeleniumManager(); print(f"{str(sm._get_binary())}")') - echo "$SELENIUM_MANAGER_EXE" - echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV" - echo "$WEBDRIVERPATH" - name: Run tests under specified config run: | From 85770182cc72935f309603983c31edb965da5004 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 17:17:45 -0500 Subject: [PATCH 403/407] Removed install chromedriver flag on setup chrome --- .github/workflows/Select.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml index 04cc63ecd..071eeb749 100644 --- a/.github/workflows/Select.yml +++ b/.github/workflows/Select.yml @@ -35,7 +35,6 @@ jobs: with: chrome-version: latest install-dependencies: true - install-chromedriver: true id: setup-chrome - run: | echo Installed chromium version: ${{ steps.setup-chrome.outputs.chrome-version }} From d43c0fb42f33150147496e833be19adeb7da2f2b Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 18:12:29 -0500 Subject: [PATCH 404/407] Yearly update of cookies --- atest/acceptance/keywords/cookies.robot | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 2349bc68d..29c581ae9 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -36,15 +36,21 @@ Add Cookie When Secure Is False Should Be Equal ${cookie.secure} ${False} Add Cookie When Expiry Is Epoch - Add Cookie Cookie1 value1 expiry=1761755100 + # To convert epoch to formatted string + # from time import strftime, localtime + # strftime('%Y-%m-%d %H:%M:%S', localtime(1793247900)) + # To update time each September (as Chrome limits cookies to one year expiry date) use + # import datetime + # print (datetime.datetime.strptime("2027-10-29 12:25:00", "%Y-%m-%d %I:%M:%S").timestamp()) + Add Cookie Cookie1 value1 expiry=1793247900 ${cookie} = Get Cookie Cookie1 ${expiry} = Convert Date ${1761755100} exclude_millis=True Should Be Equal As Strings ${cookie.expiry} ${expiry} Add Cookie When Expiry Is Human Readable Data&Time - Add Cookie Cookie12 value12 expiry=2025-10-29 12:25:00 + Add Cookie Cookie12 value12 expiry=2026-10-29 12:25:00 ${cookie} = Get Cookie Cookie12 - Should Be Equal As Strings ${cookie.expiry} 2025-10-29 12:25:00 + Should Be Equal As Strings ${cookie.expiry} 2026-10-29 12:25:00 Delete Cookie [Tags] Known Issue Safari @@ -122,7 +128,7 @@ Test Get Cookie Keyword Logging Add Cookies # To update time each September (as Chrome limits cookies to one year expiry date) use # import datetime - # print (datetime.datetime.strptime("2025-09-01 12:25:00", "%Y-%m-%d %I:%M:%S").timestamp()) + # print (datetime.datetime.strptime("2027-09-01 12:25:00", "%Y-%m-%d %I:%M:%S").timestamp()) Delete All Cookies Add Cookie test seleniumlibrary ${now} = Get Current Date @@ -130,4 +136,4 @@ Add Cookies ${tomorrow_thistime_datetime} = Convert Date ${tomorrow_thistime} datetime Set Suite Variable ${tomorrow_thistime_datetime} Add Cookie another value expiry=${tomorrow_thistime} - Add Cookie far_future timemachine expiry=1756700700 # 2025-09-01 12:25:00 + Add Cookie far_future timemachine expiry=1788236700 # 2026-09-01 12:25:00 From 36b553a03201c42f695a5be04cbc45dbbe61d5e7 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 19:01:57 -0500 Subject: [PATCH 405/407] Update couple more cookie tests for the new year --- atest/acceptance/keywords/cookies.robot | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atest/acceptance/keywords/cookies.robot b/atest/acceptance/keywords/cookies.robot index 29c581ae9..04b355e6a 100644 --- a/atest/acceptance/keywords/cookies.robot +++ b/atest/acceptance/keywords/cookies.robot @@ -44,7 +44,7 @@ Add Cookie When Expiry Is Epoch # print (datetime.datetime.strptime("2027-10-29 12:25:00", "%Y-%m-%d %I:%M:%S").timestamp()) Add Cookie Cookie1 value1 expiry=1793247900 ${cookie} = Get Cookie Cookie1 - ${expiry} = Convert Date ${1761755100} exclude_millis=True + ${expiry} = Convert Date ${1793247900} exclude_millis=True Should Be Equal As Strings ${cookie.expiry} ${expiry} Add Cookie When Expiry Is Human Readable Data&Time @@ -120,7 +120,7 @@ Test Get Cookie Keyword Logging ... domain=localhost ... secure=False ... httpOnly=False - ... expiry=2025-09-01 *:25:00 + ... expiry=2026-09-01 *:25:00 ... extra={'sameSite': 'Lax'} ${cookie} = Get Cookie far_future From de6932f0a27b262dba7bc2bca23910e7d63cfaf0 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 19:31:53 -0500 Subject: [PATCH 406/407] Update GitHub Action Workflows - Switched over to select.yml for pull request and pushes - Renamed the select workflow - Added an older rf version configuration to the test matrix --- .github/workflows/CI.yml | 2 +- .github/workflows/Select.yml | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 1ba18d3db..3a44bbd07 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,6 @@ name: SeleniumLibrary CI -on: [push, pull_request] +on: workflow_dispatch jobs: build: diff --git a/.github/workflows/Select.yml b/.github/workflows/Select.yml index 071eeb749..dcb89c7e4 100644 --- a/.github/workflows/Select.yml +++ b/.github/workflows/Select.yml @@ -1,6 +1,6 @@ -name: Select Configurations +name: Selected Test Configuration Matrix -on: workflow_dispatch +on: [push, pull_request] jobs: test_config: @@ -19,6 +19,11 @@ jobs: rf-version: 7.3.2 selenium-version: 4.38.0 browser: chrome + - description: older_rf_version + python-version: 3.11.14 + rf-version: 6.1.1 + selenium-version: 4.37.0 + browser: chrome steps: - uses: actions/checkout@v4 From 5703ea9cedfcbba3c71f470d1055ebfb03a61d8e Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 18 Jan 2026 21:18:25 -0500 Subject: [PATCH 407/407] Switching dependebot to monthly --- .github/dependabot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8c763bf21..26490b671 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,8 +3,8 @@ updates: - package-ecosystem: "pip" directory: "/" schedule: - interval: "daily" + interval: "monthly" - package-ecosystem: "github-actions" directory: "/" schedule: - interval: "daily" \ No newline at end of file + interval: "monthly" \ No newline at end of file