- 
          
 - 
                Notifications
    
You must be signed in to change notification settings  - Fork 8.6k
 
          [py][bidi]: add enable_webextensions option for chromium-based browsers
          #15794
        
          New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 15 commits
9d5c344
              c88cc84
              9ee46c7
              15924f1
              2e386b9
              0215732
              03f7be2
              26d4dc9
              3c8f861
              81d4720
              ea6b3ff
              19b5468
              4dd1169
              4e73b97
              433bec7
              3d604bc
              6958a1f
              ae9fded
              File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | 
|---|---|---|
| 
          
            
          
           | 
    @@ -33,6 +33,7 @@ def __init__(self) -> None: | |
| self._extensions: list[str] = [] | ||
| self._experimental_options: dict[str, Union[str, int, dict, list[str]]] = {} | ||
| self._debugger_address: Optional[str] = None | ||
| self._enable_webextensions: bool = False | ||
| 
     | 
||
| @property | ||
| def binary_location(self) -> str: | ||
| 
          
            
          
           | 
    @@ -126,6 +127,39 @@ def add_experimental_option(self, name: str, value: Union[str, int, dict, list[s | |
| """ | ||
| self._experimental_options[name] = value | ||
| 
     | 
||
| @property | ||
| def enable_webextensions(self) -> bool: | ||
| """Returns whether webextension support is enabled for Chromium-based browsers. | ||
| 
     | 
||
| :Returns: True if webextension support is enabled, False otherwise. | ||
| """ | ||
| return self._enable_webextensions | ||
| 
     | 
||
| @enable_webextensions.setter | ||
| def enable_webextensions(self, value: bool) -> None: | ||
| """Enables or disables webextension support for Chromium-based browsers. | ||
| 
     | 
||
| When enabled, this automatically adds the required Chromium flags: | ||
| - --enable-unsafe-extension-debugging | ||
| - --remote-debugging-pipe | ||
| 
     | 
||
| :Args: | ||
| - value: True to enable webextension support, False to disable. | ||
| """ | ||
| self._enable_webextensions = value | ||
| if value: | ||
| # Add required flags for Chromium webextension support | ||
| required_flags = ["--enable-unsafe-extension-debugging", "--remote-debugging-pipe"] | ||
| for flag in required_flags: | ||
| if flag not in self._arguments: | ||
| self.add_argument(flag) | ||
| else: | ||
| # Remove webextension flags if disabling | ||
| flags_to_remove = ["--enable-unsafe-extension-debugging", "--remote-debugging-pipe"] | ||
| 
         There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wanted to note that from my reading of the      options = webdriver.ChromeOptions()
    options.add_argument("--remote-debugging-pipe")
    options.enable_webextensions = Falseit will negate that command line switch and might be tough to debug. Probably the method documentation should note that disabling removes both switches. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was discussed but no conclusion was made - #15794 (comment), what do you think would be the best way to resolve this? Adding docs is good.  | 
||
| for flag in flags_to_remove: | ||
| if flag in self._arguments: | ||
| self._arguments.remove(flag) | ||
| 
     | 
||
| def to_capabilities(self) -> dict: | ||
| """Creates a capabilities with all the options that have been set | ||
| :Returns: A dictionary with everything.""" | ||
| 
          
            
          
           | 
    ||
Uh oh!
There was an error while loading. Please reload this page.