From 622d64e5d8856fd0a80e7bb1a0e34bc06ef31fb2 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Mon, 30 Oct 2023 14:45:03 -0400 Subject: [PATCH 01/10] 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 02/10] 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 03/10] 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 04/10] 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 05/10] 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 06/10] 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 07/10] 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 08/10] 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 09/10] 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 10/10] 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