Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saizk/auto-selenium
Automatic download of Selenium Web Drivers for all browsers
https://github.com/saizk/auto-selenium
python selenium
Last synced: 3 months ago
JSON representation
Automatic download of Selenium Web Drivers for all browsers
- Host: GitHub
- URL: https://github.com/saizk/auto-selenium
- Owner: saizk
- License: mit
- Created: 2021-11-04T22:24:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-08-03T05:20:41.000Z (over 1 year ago)
- Last Synced: 2024-11-10T09:41:07.002Z (3 months ago)
- Topics: python, selenium
- Language: Python
- Homepage:
- Size: 18.6 KB
- Stars: 8
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# auto-selenium
![PyPI version](https://img.shields.io/pypi/v/auto-selenium)Auto-Selenium is a Python tool to automate the download of Selenium Web Drivers and store the profile sessions for the following browsers:
* Google Chrome
* Firefox
* Opera
* Brave
* Edge (only for Windows)It utilizes Selenium and MSEdge tools
## Quickstart examples
### Installation
```Python
pip install auto-selenium
```### Simple Usage
```Python
from autoselenium import Driverdriver = Driver('chrome') # downloads driver based on current version of the browser
driver.get('https://www.google.com/')
```### Context Manager
```Python
with Driver('brave', root='drivers') as driver: # equivalent to Selenium's WebDriver object
driver.get('https://www.github.com/saizk')
# Selenium Webdriver command examples
driver.find_elements_by_tag_name('div')
driver.refresh()
```### Download specific versions of each driver
```Python
from autoselenium import download_driver, get_versiondownload_driver('firefox', version='0.29.1', root='drivers')
download_driver('opera', 'latest')cversion = get_version('brave', 'current')
lversion = get_version('brave', 'latest')if cversion < lversion:
print('You should update your browser!')
```
You can specify between 'current', 'latest' or input an specific version for a driver.### Create your custom driver
```Python
import autoseleniumclass TwitterBot(autoselenium.Driver):
_URL = 'https://twitter.com'
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.logged = False
def log(self):
self.logged = True
pass
def scrape(self):
pass
```
## Contribute
Would you like to contribute to this project? Here are a few starters:
- Improve documentation
- Add Testing examples
- Bug hunts and refactor
- Additional features/ More integrations
- Phantom JS support
- Implement default browser functions for Mac