Skip to content

Commit 52849e4

Browse files
authored
Merge pull request #1862 from emanlove/update-test-under-python-versions
Update test under python versions
2 parents 6008d6c + 00ea092 commit 52849e4

File tree

8 files changed

+44
-37
lines changed

8 files changed

+44
-37
lines changed

.github/workflows/CI.yml

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ jobs:
66
build:
77

88
runs-on: ubuntu-latest
9+
continue-on-error: true
910
strategy:
1011
matrix:
11-
python-version: [3.7, 3.9, pypy-3.7]
12+
python-version: [3.8, 3.11] # 3.12, pypy-3.9
1213
rf-version: [4.1.3, 5.0.1, 6.0.1]
1314

1415
steps:
@@ -35,7 +36,7 @@ jobs:
3536
python -m pip install --upgrade pip
3637
pip install -r requirements-dev.txt
3738
- name: Install dependencies for pypy
38-
if: matrix.python-version == 'pypy-3.7'
39+
if: matrix.python-version == 'pypy-3.9'
3940
run: |
4041
python -m pip install --upgrade pip
4142
pip install -r requirements.txt
@@ -51,24 +52,21 @@ jobs:
5152
echo "WEBDRIVERPATH=$($SELENIUM_MANAGER_EXE --browser chrome --debug | awk '/INFO[[:space:]]Driver path:/ {print $NF;exit}')" >> "$GITHUB_ENV"
5253
echo "$WEBDRIVERPATH"
5354
- name: Generate stub file for ${{ matrix.python-version }}
54-
if: matrix.python-version != 'pypy-3.7'
55+
if: matrix.python-version != 'pypy-3.9'
5556
run: |
5657
invoke gen-stub
57-
- name: Debugging
58-
if: matrix.python-version != 'pypy-3.7'
59-
run: |
60-
which python
6158
6259
- name: Run tests with headless Chrome and with PyPy
63-
if: matrix.python-version == 'pypy-3.7'
60+
if: matrix.python-version == 'pypy-3.9'
6461
run: |
6562
xvfb-run --auto-servernum python atest/run.py --nounit --zip headlesschrome
6663
67-
- name: Run tests with normal Chrome and with Python 3.7
68-
if: matrix.python-version == '3.7'
64+
- name: Run tests with normal Chrome if CPython
65+
if: matrix.python-version != 'pypy-3.9'
6966
run: |
7067
xvfb-run --auto-servernum python atest/run.py --zip chrome
7168
69+
# Recognize for the moment this will NOT run as we aren't using Python 3.9
7270
- name: Run tests with headless Firefox with Python 3.9 and RF 4.1.3
7371
if: matrix.python-version == '3.9' && matrix.rf-version == '4.1.3'
7472
run: |
@@ -79,12 +77,12 @@ jobs:
7977
run: |
8078
xvfb-run --auto-servernum python atest/run.py --zip firefox
8179
82-
- name: Run tests with Selenium Grid
83-
if: matrix.python-version == '3.8' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7'
84-
run: |
85-
wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
86-
sudo chmod u+x ./selenium-server-standalone.jar
87-
xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True
80+
# - name: Run tests with Selenium Grid
81+
# if: matrix.python-version == '3.11' && matrix.rf-version == '3.2.2' && matrix.python-version != 'pypy-3.7'
82+
# run: |
83+
# wget --no-verbose --output-document=./selenium-server-standalone.jar http://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
84+
# sudo chmod u+x ./selenium-server-standalone.jar
85+
# xvfb-run --auto-servernum python atest/run.py --zip headlesschrome --grid True
8886

8987
- uses: actions/upload-artifact@v1
9088
if: success() || failure()

atest/acceptance/create_webdriver.robot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Library Collections
77
Create Webdriver Creates Functioning WebDriver
88
[Documentation]
99
... LOG 1:1 INFO REGEXP: Creating an instance of the \\w+ WebDriver.
10-
... LOG 1:25 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
10+
... LOG 1:19 DEBUG REGEXP: Created \\w+ WebDriver instance with session id (\\w|-)+.
1111
[Tags] Known Issue Internet Explorer Known Issue Safari
1212
[Setup] Set Driver Variables
1313
Create Webdriver ${DRIVER_NAME} kwargs=${KWARGS}
@@ -30,7 +30,7 @@ Create Webdriver With Bad Keyword Argument Dictionary
3030
[Documentation] Invalid arguments types
3131
${status} ${error} = Run Keyword And Ignore Error Create Webdriver Firefox kwargs={'spam': 'eggs'}
3232
Should Be Equal ${status} FAIL
33-
Should Match Regexp ${error} (TypeError: __init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.)
33+
Should Match Regexp ${error} (TypeError: (?:WebDriver.)?__init__\\(\\) got an unexpected keyword argument 'spam'|kwargs must be a dictionary\.)
3434

3535
*** Keywords ***
3636
Set Driver Variables

atest/acceptance/keywords/choose_file.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Choose File With Grid From Library Using SL choose_file method
4545

4646
Input Text Should Work Same Way When Not Using Grid
4747
[Documentation]
48-
... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {"*
48+
... LOG 1:6 DEBUG GLOB: POST*/session/*/clear {*
4949
... LOG 1:9 DEBUG Finished Request
5050
... LOG 1:10 DEBUG GLOB: POST*/session/*/value*"text": "*
5151
... LOG 1:13 DEBUG Finished Request

atest/acceptance/keywords/content_assertions.robot

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Page Should Contain Using Default Custom Log Level
3333
... 'TRACE' - noting the excluded second argument for the `Page Should Contain`
3434
... keyword) fails and the log contains the html content.
3535
... FAIL Page should have contained text 'non existing text' but did not.
36-
... LOG 2:19 TRACE REGEXP: (?i)<html.*</html>
36+
... LOG 2:19 TRACE REGEXP: <html.*</html>
3737
... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not.
3838
${old_level}= Set Log Level TRACE
3939
Page Should Contain non existing text
@@ -53,31 +53,31 @@ Page Should Contain With Custom Log Level INFO
5353
[Tags] NoGrid
5454
[Documentation] Html content is shown at the explicitly specified INFO level.
5555
... FAIL Page should have contained text 'non existing text' but did not.
56-
... LOG 1:18 INFO REGEXP: (?i)<html.*</html>
56+
... LOG 1:18 INFO REGEXP: <html.*</html>
5757
... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not.
5858
Page Should Contain non existing text INFO
5959

6060
Page Should Contain With Custom Log Level WARN
6161
[Tags] NoGrid
6262
[Documentation] Html content is shown at the explicitly specified WARN level.
6363
... FAIL Page should have contained text 'non existing text' but did not.
64-
... LOG 1:18 WARN REGEXP: (?i)<html.*</html>
64+
... LOG 1:18 WARN REGEXP: <html.*</html>
6565
... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not.
6666
Page Should Contain non existing text WARN
6767

6868
Page Should Contain With Custom Log Level DEBUG
6969
[Tags] NoGrid
7070
[Documentation] Html content is shown at the explicitly specified DEBUG level.
7171
... FAIL Page should have contained text 'non existing text' but did not.
72-
... LOG 1:18 DEBUG REGEXP: (?i)<html.*</html>
72+
... LOG 1:18 DEBUG REGEXP: <html.*</html>
7373
... LOG 1:19 FAIL Page should have contained text 'non existing text' but did not.
7474
Page Should Contain non existing text DEBUG
7575

7676
Page Should Contain With Custom Log Level TRACE
7777
[Tags] NoGrid
7878
[Documentation] Html content is shown at the explicitly specified TRACE level.
7979
... FAIL Page should have contained text 'non existing text' but did not.
80-
... LOG 2:19 TRACE REGEXP: (?i)<html.*</html>
80+
... LOG 2:19 TRACE REGEXP: <html.*</html>
8181
... LOG 2:20 FAIL Page should have contained text 'non existing text' but did not.
8282
Set Log Level TRACE
8383
Page Should Contain non existing text TRACE
@@ -122,7 +122,7 @@ Page Should Not Contain
122122

123123
Page Should Not Contain With Custom Log Level
124124
[Tags] NoGrid
125-
[Documentation] LOG 1.1:13 DEBUG REGEXP: (?i)<html.*</html>
125+
[Documentation] LOG 1.1:13 DEBUG REGEXP: <html.*</html>
126126
Run Keyword And Expect Error
127127
... Page should not have contained text 'needle'.
128128
... Page Should Not Contain needle DEBUG

atest/acceptance/keywords/page_load_timeout.robot

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ Test Teardown Close Browser And Reset Page Load Timeout
77
*** Test Cases ***
88
Should Open Browser With Default Page Load Timeout
99
[Documentation] Verify that 'Open Browser' changes the page load timeout.
10-
... LOG 1.1.1:33 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000}
11-
... LOG 1.1.1:35 DEBUG STARTS: Remote response: status=200
12-
# ... LOG 1.1.1:16 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000}
13-
# ... LOG 1.1.1:18 DEBUG STARTS: Remote response: status=200
10+
... LOG 1.1.1:27 DEBUG REGEXP: POST http://localhost:\\d{2,5}/session/[a-f0-9-]+/timeouts {"pageLoad": 300000}
11+
... LOG 1.1.1:29 DEBUG STARTS: Remote response: status=200
12+
# Note: previous log check was 33 and 37. Recording to see if something is swtiching back and forth
1413
Open Browser To Start Page
1514

1615
Should Run Into Timeout Exception

atest/acceptance/multiple_browsers_options.robot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ Chrome Browser With Selenium Options As String
1515
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument("--disable-dev-shm-usage")
1616
... executable_path=%{WEBDRIVERPATH}
1717

18-
Chrome Browser With Selenium Options As String With Attirbute As True
18+
Chrome Browser With Selenium Options As String With Attribute As True
1919
[Documentation]
2020
... LOG 1:3 DEBUG GLOB: *"goog:chromeOptions"*
2121
... LOG 1:3 DEBUG GLOB: *args": ["--disable-dev-shm-usage"?*
22-
... LOG 1:3 DEBUG GLOB: *"--headless"*
22+
... LOG 1:3 DEBUG GLOB: *"--headless=new"*
2323
Open Browser ${FRONT PAGE} ${BROWSER} remote_url=${REMOTE_URL}
24-
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; headless = True
24+
... desired_capabilities=${DESIRED_CAPABILITIES} options=add_argument ( "--disable-dev-shm-usage" ) ; add_argument ( "--headless=new" )
2525
... executable_path=%{WEBDRIVERPATH}
2626

2727
Chrome Browser With Selenium Options With Complex Object

atest/acceptance/multiple_browsers_service_log_path.robot

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ First Browser With Service Log Path
77
[Documentation]
88
... LOG 1:2 INFO STARTS: Browser driver log file created to:
99
[Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}.log
10-
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}.log
10+
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}.log
11+
OperatingSystem.List Directories In Directory ${OUTPUT DIR}/
12+
${output}= OperatingSystem.Run ls -lh
1113
OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}.log
1214

1315
Second Browser With Service Log Path And Index
1416
[Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}-1.log
15-
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}-{index}.log
17+
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}-{index}.log
1618
OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}-1.log
1719

1820
Third Browser With Service Log Path And Index Should Not Overwrite
1921
[Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/${BROWSER}-2.log
20-
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${BROWSER}-{index}.log
22+
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/${BROWSER}-{index}.log
2123
OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/${BROWSER}-2.log
2224

2325
Fourth Browser With Service Log Path In Subfolder
2426
[Setup] OperatingSystem.Remove Files ${OUTPUT DIR}/a_folder/${BROWSER}-1.log
25-
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=a_folder/${BROWSER}-{index}.log
27+
Open Browser ${FRONT PAGE} ${BROWSER} service_log_path=${OUTPUT DIR}/a_folder/${BROWSER}-{index}.log
2628
OperatingSystem.File Should Not Be Empty ${OUTPUT DIR}/a_folder/${BROWSER}-1.log

src/SeleniumLibrary/keywords/webdrivertools/webdrivertools.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,15 @@ def create_chrome(
145145
return self._remote(remote_url, options=options)
146146
if not executable_path:
147147
executable_path = self._get_executable_path(webdriver.chrome.service.Service)
148-
service = ChromeService(executable_path=executable_path, log_path=service_log_path)
148+
# -- temporary fix to transition selenium to v4.13 from v4.11 and prior
149+
from inspect import signature
150+
sig = signature(ChromeService)
151+
if 'log_output' in str(sig):
152+
log_method = {'log_output': service_log_path}
153+
else:
154+
log_method = {'log_path': service_log_path}
155+
# --
156+
service = ChromeService(executable_path=executable_path, **log_method)
149157
return webdriver.Chrome(
150158
options=options,
151159
service=service,

0 commit comments

Comments
 (0)