Giter VIP home page Giter VIP logo

Comments (1)

mfalesni avatar mfalesni commented on August 16, 2024 1

If I were still working on Widgetastic, I would probably suggest creating a sort of "middleware" system for the methods of browser and decorate all relevant browser methods with it:

@plugin_handler
def move_to_element(self, ...):
    # ...

Then the plugin_handler would look into the browser plugin instance for clues what to do when anything unexpected happens. Might be a simple value (retry_stale_element could be moved into that middleware as a retry_stale_element = True|False), or a method per browser-method where one could fine-tune things the framework does when situations specific to the project happen and drive it from there. An example for this use case could look something like this:

class MyBrowserPlugin(BrowserPlugin):
    class Handlers:
        def move_to_element(self, executor):
            try:
                return executor()
            except AnException:
                if executor.params.something:
                    raise  # Give up based on the params passed to the move_to_elements
                do_something()
                return executor(with_modified_param="eg_foo")

    class Tweaks:
        retry_on_stale_element = {'move_to_element', 'whatever_else'}

btw. hai 👋

from widgetastic.core.

Related Issues (20)

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.