Skip to content

Commit

Permalink
Add plugin tag to the keywords coming from plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
aaltat committed Jan 6, 2023
1 parent 3318207 commit a61aedc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Browser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,11 @@ def __init__(
libraries.append(self._initialize_jsextension(params["jsextension"]))
if params["plugins"] is not None:
parser = PluginParser(LibraryComponent, [self])
libraries.extend(parser.parse_plugins(params["plugins"]))
parsed_plugins = parser.parse_plugins(params["plugins"])
libraries.extend(parsed_plugins)
self._plugin_keywords = parser.get_plugin_keywords(parsed_plugins)
else:
self._plugin_keywords = []
self.presenter_mode: Union[HighLightElement, bool] = params[
"enable_presenter_mode"
]
Expand Down Expand Up @@ -1058,6 +1062,12 @@ def run_keyword(self, name, args, kwargs=None):
input()
raise e

def get_keyword_tags(self, name: str) -> list:
tags = list(DynamicCore.get_keyword_tags(self, name))
if name in self._plugin_keywords:
tags.append("plugin")
return tags

def _end_keyword(self, name, attrs):
if "secret" in attrs["kwname"].lower() and attrs["libname"] == "Browser":
self._set_logging(True)
Expand Down
1 change: 1 addition & 0 deletions docs/plugins/example/ExamplePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ def new_plugin_cookie_keyword(self) -> dict:
"name": cookie["name"],
"value": cookie["value"]
}
return {}

def now_keyword(self): # This is not keyword
print(1)

0 comments on commit a61aedc

Please sign in to comment.