GithubHelp home page GithubHelp logo

soebb / auto-selenium Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saizk/auto-selenium

0.0 0.0 0.0 19 KB

Automatic download of Selenium Web Drivers for all browsers

License: MIT License

Python 100.00%

auto-selenium's Introduction

auto-selenium

PyPI version

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

pip install auto-selenium

Simple Usage

from autoselenium import Driver

driver = Driver('chrome')  # downloads driver based on current version of the browser
driver.get('https://www.google.com/')

Context Manager

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

from autoselenium import download_driver, get_version

download_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

import autoselenium

class 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

auto-selenium's People

Contributors

saizk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.