From 16578bc566539749f437f45ec43a4afd08ce8c3c Mon Sep 17 00:00:00 2001 From: swapnil-verma-gl <92505353+swapnil-verma-gl@users.noreply.github.com> Date: Fri, 21 Jun 2024 14:28:46 +0530 Subject: [PATCH] Updated update-to-newest-webdriver.sh to be compatible with linux (#9850) --- .../update-to-newest-webdriver.sh | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/webdriver-update-newest/update-to-newest-webdriver.sh b/scripts/webdriver-update-newest/update-to-newest-webdriver.sh index 3c398148b7..0ab87aa3e3 100755 --- a/scripts/webdriver-update-newest/update-to-newest-webdriver.sh +++ b/scripts/webdriver-update-newest/update-to-newest-webdriver.sh @@ -1,12 +1,26 @@ #!/usr/bin/env bash DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [ "$(uname)" == "Darwin" ]; then + BROWSER_TYPE="mac-x64" +elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + BROWSER_TYPE="linux64" +elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then + BROWSER_TYPE="win32" +elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then + BROWSER_TYPE="win64" +fi + echo "Getting currently installed Chrome Version" if [ "$CI" = "true" ]; then chromeVersion=$(google-chrome --version ) else - chromeVersion=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version ) + if [ "$BROWSER_TYPE" = "mac-x64" ]; then + chromeVersion=$(/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version ) + elif [ "$BROWSER_TYPE" = "linux64" ]; then + chromeVersion=$( /usr/bin/google-chrome-stable --version ) + fi fi chromeVersion=${chromeVersion:14:20} @@ -29,16 +43,6 @@ function show_error() { ROOTDIR="$DIR/.." -if [ "$(uname)" == "Darwin" ]; then - BROWSER_TYPE="mac-x64" -elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then - BROWSER_TYPE="linux64" -elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then - BROWSER_TYPE="win32" -elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW64_NT" ]; then - BROWSER_TYPE="win64" -fi - echo "BROWSER => $BROWSER_TYPE"