From c9147e7522c9357b8d4cb0ab82ee4251f2f17e82 Mon Sep 17 00:00:00 2001 From: Ed Manlove Date: Sun, 29 Oct 2023 13:19:07 -0400 Subject: [PATCH 1/8] 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 2/8] 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 3/8] 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 4/8] 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 5/8] 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 6/8] 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 7/8] 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 8/8] 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 ***