dunossauro / tigre

Tigre is a helper to always call the correct webdriver
MIT License
42 stars 9 forks source link

Local browsers webdriver support #24

Open dunossauro opened 4 years ago

dunossauro commented 4 years ago

The main idea is to build a wrapper from selenium webdriver classes.

For example, in selenium.webdriver we have all supported browsers

In Tigre namespace, we can use tigre.local

from tigre.local import Firefox

# the same code that

from selenium.webdriver import Firefox

In the future, we can think about dynamic options. But we can start making a simple wrapper. Something like

from importlib import import_module
webdrivers = import_module('selenium.webdriver')

def __getattr__(browser_name):
    try:
        return getattr(webdrivers, browser_name)
    except:
        raise ImportError(f"cannot import name '{browser_name}' from 'tigre.local'")