项目作者: nanasess

项目描述 :
ChromeDriver for use in GitHub Actions
高级语言: JavaScript
项目地址: git://github.com/nanasess/setup-chromedriver.git
创建时间: 2019-10-03T00:13:54Z
项目社区:https://github.com/nanasess/setup-chromedriver

开源协议:MIT License

下载




# 🚀 setup-chromedriver

A GitHub Action to set up ChromeDriver for automated testing

Test on Linux & macOS
Test on Windows
GitHub release
License
GitHub Sponsors


Features
Quick Start
Usage
Platform Support
Configuration
Examples
Contributing




✨ Features

  • 🔧 Automatic Version Matching - Automatically installs ChromeDriver that matches your Chrome browser version
  • 🖥️ Cross-Platform - Works on Ubuntu, macOS, and Windows
  • Fast Setup - Quick installation with minimal configuration
  • 🎯 Version Control - Option to specify exact ChromeDriver version
  • 🛠️ Custom Chrome Binary - Support for custom Chrome binary names

🚀 Quick Start

Add this step to your workflow to automatically set up ChromeDriver:

  1. - uses: nanasess/setup-chromedriver@v2

That’s it! ChromeDriver will be installed and added to your PATH.

📖 Usage

Basic Usage

The simplest way to use this action is without any parameters. It will automatically detect your Chrome version and install the matching ChromeDriver:

  1. steps:
  2. - uses: actions/checkout@v4
  3. - uses: nanasess/setup-chromedriver@v2
  4. - run: chromedriver --version

Specify ChromeDriver Version

If you need a specific version of ChromeDriver:

  1. steps:
  2. - uses: actions/checkout@v4
  3. - uses: nanasess/setup-chromedriver@v2
  4. with:
  5. chromedriver-version: '131.0.6778.87'
  6. - run: chromedriver --version

Custom Chrome Binary

If your Chrome binary has a custom name:

  1. steps:
  2. - uses: actions/checkout@v4
  3. - uses: nanasess/setup-chromedriver@v2
  4. with:
  5. chromeapp: chrome-beta

🖥️ Platform Support

Platform Versions
Ubuntu ubuntu-latest, ubuntu-24.04, ubuntu-22.04
macOS macos-latest, macos-14, macos-13
Windows windows-latest, windows-2022, windows-2019

⚙️ Configuration

Input Parameters

Parameter Description Required Default
chromedriver-version The ChromeDriver version to install No Auto-detected
chromeapp Custom Chrome binary name (Linux/macOS only) No System default

📚 Examples

Running Tests on Ubuntu/macOS with Xvfb

  1. name: UI Tests
  2. on: [push, pull_request]
  3. jobs:
  4. test:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - uses: actions/checkout@v4
  8. - uses: nanasess/setup-chromedriver@v2
  9. - name: Start ChromeDriver
  10. run: |
  11. export DISPLAY=:99
  12. chromedriver --url-base=/wd/hub &
  13. sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
  14. - name: Run tests
  15. run: npm test

Running Tests on Windows

  1. name: Windows UI Tests
  2. on: [push, pull_request]
  3. jobs:
  4. test:
  5. runs-on: windows-latest
  6. steps:
  7. - uses: actions/checkout@v4
  8. - uses: nanasess/setup-chromedriver@v2
  9. - name: Start ChromeDriver
  10. run: chromedriver --url-base=/wd/hub &
  11. - name: Run tests
  12. run: npm test

Matrix Testing Across Platforms

  1. name: Cross-Platform Tests
  2. on: [push, pull_request]
  3. jobs:
  4. test:
  5. strategy:
  6. matrix:
  7. os: [ubuntu-latest, windows-latest, macos-latest]
  8. runs-on: ${{ matrix.os }}
  9. steps:
  10. - uses: actions/checkout@v4
  11. - uses: nanasess/setup-chromedriver@v2
  12. - name: Run tests
  13. run: npm test

Testing with Specific Chrome Version

  1. name: Chrome Version Test
  2. on: [push]
  3. jobs:
  4. test:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - uses: actions/checkout@v4
  8. - name: Setup Chrome
  9. uses: browser-actions/setup-chrome@v1
  10. with:
  11. chrome-version: '131'
  12. - uses: nanasess/setup-chromedriver@v2
  13. with:
  14. chromedriver-version: '131.0.6778.87'
  15. - name: Run tests
  16. run: npm test

🤝 Contributing

Contributions are welcome! Here’s how you can help:

  1. 🍴 Fork the repository
  2. 🔧 Create your feature branch (git checkout -b feature/amazing-feature)
  3. 💻 Make your changes
  4. ✅ Run tests with yarn test
  5. 📝 Commit your changes (git commit -m 'Add amazing feature')
  6. 📤 Push to the branch (git push origin feature/amazing-feature)
  7. 🔄 Open a Pull Request

Development Setup

  1. # Install dependencies
  2. yarn install --frozen-lockfile
  3. # Build the action
  4. yarn build
  5. yarn package
  6. # Run tests
  7. yarn test
  8. # Format code
  9. yarn format

For more details on the architecture and development process, see CLAUDE.md.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

  • Thanks to all contributors who have helped improve this action
  • Special thanks to the ChromeDriver team for their excellent work

💖 Support

If you find this action helpful, please consider:




Made with ❤️ by @nanasess