-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* [AAE-1653] Script to update webdriver locally ADF * update readme * trigger ci
- Loading branch information
1 parent
729a65c
commit de16072
Showing
4 changed files
with
554 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Run protractor with newest webdriver locally | ||
|
||
## Instruction | ||
To download newest driver simply run script from its directory | ||
`update-to-newest-webdriver.sh` | ||
|
||
Command accepts one parameter to define what OS you are using. By default its set to `mac-x64` | ||
Possible inputs `linux64, mac-arm64, mac-x64, win32, win64` | ||
|
||
Example `./update-to-newest-webdriver.sh win64` - will set driver for windows | ||
|
||
## How it works | ||
1. The script removes your existing driver files from webdriver node_modules | ||
2. Generates two new files (chrome_xml.js and update.js) that have updated methods needed to get the new driver | ||
3. Replaces browser type depending on parameter | ||
4. Copies and replaces the files to the webdriver node_modules | ||
5. Executes command to to update-webdriver using updated code | ||
|
||
## Troubleshooting | ||
If the script fails for any reason. You can do some of these actions manually: | ||
1. Find the two files (chrome_xml.js and update.js) in node_modules/webdriver-manager | ||
2. Replace its contents with (chrome_xml_schema.js and update_schema.js) keep the original names. | ||
3. Change version for specific OS in both files | ||
chrome_xml.js -> ['platform'] == 'mac-x64' e.g. ['platform'] == 'win64' Line 70 | ||
update.js -> 'chromedriver-mac-x64' e.g 'chromedriver-win64' Line 240 | ||
4. Run standard command to update webdriver `./node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false` | ||
|
||
|
||
|
||
## Reason | ||
Latest ChromeDriver Binaries https://googlechromelabs.github.io/chrome-for-testing/ | ||
|
||
Starting with M115 the latest Chrome + ChromeDriver releases per release channel (Stable, Beta, Dev, Canary) are available at the Chrome for Testing availability dashboard. For automated version downloading one can use the convenient JSON endpoints. | ||
The older releases can be found at the Downloads page. | ||
|
||
|
||
Note: Protractor is a depricated tool and this probably won't be fixed. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
scripts/webdriver-update-newest/update-to-newest-webdriver.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
#set -x | ||
BROWSER_TYPE=mac-x64 | ||
|
||
if [ ! -z "$1" ]; then BROWSER_TYPE=$1 ; fi | ||
|
||
PATH_TO_COMMANDS=../../node_modules/webdriver-manager/built/lib/cmds | ||
PATH_TO_BINARIES=../../node_modules/webdriver-manager/built/lib/binaries | ||
PATH_TO_SELENIUM=../../node_modules/webdriver-manager/selenium | ||
|
||
# Remove existing drivers | ||
rm -rf $PATH_TO_SELENIUM/selenium-server-* | ||
rm -rf $PATH_TO_SELENIUM/chromedriver-* | ||
rm -f $PATH_TO_SELENIUM/chromedriver_* | ||
|
||
# Replace browser type in file and create new file | ||
sed "s/mac-x64/$BROWSER_TYPE/" chrome_xml_schema.js > chrome_xml.js | ||
sed "s/mac-x64/$BROWSER_TYPE/" update_schema.js > update.js | ||
sleep 2 | ||
|
||
# Replace webdriver files | ||
cp -f update.js $PATH_TO_COMMANDS/update.js | ||
cp -f chrome_xml.js $PATH_TO_BINARIES/chrome_xml.js | ||
|
||
rm -f update.js | ||
rm -f chrome_xml.js | ||
|
||
#$(npm bin)/webdriver-manager update --gecko=false | ||
node ../../node_modules/webdriver-manager/bin/webdriver-manager update --gecko=false |
Oops, something went wrong.