Skip to content

ChromeDriver Version Matching #22

ChromeDriver Version Matching

ChromeDriver Version Matching #22

Workflow file for this run

name: Python Selenium CI/CD
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install Google Chrome
run: |
sudo apt-get update
sudo apt-get install -y google-chrome-stable
- name: Install ChromeDriver
run: |
# Fetch the current Chrome version
CHROME_VERSION=$(google-chrome --version | grep -oP '\d+\.\d+\.\d+' | head -n1)
CHROME_MAJOR=$(echo "$CHROME_VERSION" | cut -d '.' -f 1)
# Fetch and install the matching ChromeDriver version
DRIVER_VERSION=$(curl -s "https://chromedriver.storage.googleapis.com/LATEST_RELEASE_$CHROME_MAJOR")
echo "Installing ChromeDriver version: $DRIVER_VERSION"
wget -q "https://chromedriver.storage.googleapis.com/$DRIVER_VERSION/chromedriver_linux64.zip"
unzip chromedriver_linux64.zip
sudo mv chromedriver /usr/bin/chromedriver
sudo chmod +x /usr/bin/chromedriver
# Verify the installations
google-chrome --version
chromedriver --version
- name: Run tests
run: |
echo "Running tests in headless mode"
pytest --maxfail=1 --disable-warnings -q --html=report.html
- name: Upload test report
uses: actions/upload-artifact@v3
with:
name: pytest-report
path: report.html