wkeeling / selenium-wire

Extends Selenium's Python bindings to give you the ability to inspect requests made by the browser.
MIT License
1.86k stars 240 forks source link

Selenium Wire Remote instantiates with incorrect arguments #717

Open anthonybtedesco opened 9 months ago

anthonybtedesco commented 9 months ago

When instantiating a selenium-wire remote webdriver, it passes to the original selenium remote webdriver a desired_capabilities arguments which is not accepted. If changed to options in the init method

`class Remote(InspectRequestsMixin, DriverCommonMixin, _Remote): """Extend the Remote webdriver to provide additional methods for inspecting requests."""

def __init__(self, *args, seleniumwire_options=None, **kwargs):
    """Initialise a new Firefox WebDriver instance.

    Args:
        seleniumwire_options: The seleniumwire options dictionary.
    """
    if seleniumwire_options is None:
        seleniumwire_options = {}

    config = self._setup_backend(seleniumwire_options)

    if seleniumwire_options.get('auto_config', True):
        capabilities = kwargs.get('desired_capabilities')
        if capabilities is None:
            capabilities = DesiredCapabilities.FIREFOX.copy()
        else:
            capabilities = capabilities.copy()

        capabilities.update(config)

        kwargs['desired_capabilities'] = capabilities
        pdb.set_trace()

    super().__init__(*args, **kwargs)`

"desired_capabilities" is not a valid argument to pass, I tried changing it to "options" which is a valid argument, but then chrome crashes. Any help would be amazing on this.

amenzel1986 commented 8 months ago

I've run into the same issue. I downgraded my selenium version from 4.14.0 to 4.4.0 and was able to init a remote browser

zh199609 commented 6 months ago

本地修改对应的代码 注释kwargs['desired_capabilities'] = capabilities