Skip to content

Conversation

@jsfehler
Copy link
Collaborator

@jsfehler jsfehler commented Nov 4, 2020

This solution uses Pluggy https://pluggy.readthedocs.io/en/latest/ to add a plugin system into Splinter.

This PR features hooks for:

Plugins classes or modules can be registered via a call to splinter.plugins.register()

This PR is missing:

  • Hooks implementation for non-webdriver drivers
  • Documentation

But will be added if the overall approach works.

@jsfehler
Copy link
Collaborator Author

jsfehler commented Nov 4, 2020

This is a bare bones example of what an external driver plugin could look like:


import splinter
from splinter.driver.webdriver import BaseWebDriver


class WebDriver(BaseWebDriver):
    driver_name = "Ie"

    def __init__(self, wait_time=2):
        self.driver = Ie()

        super(WebDriver, self).__init__(wait_time)


class InternetExplorerPlugin:
    @splinter.hookimpl
    def splinter_prepare_drivers(drivers):
        drivers['internet_explorer'] = WebDriver


splinter.plugins.register(InternetExplorerPlugin())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant