forked from robotframework/SeleniumLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyPlugin.py
More file actions
36 lines (26 loc) · 935 Bytes
/
MyPlugin.py
File metadata and controls
36 lines (26 loc) · 935 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from robot.api import logger
from SeleniumLibrary.base import LibraryComponent, keyword
from SeleniumLibrary.locators import ElementFinder
class DummyFinder(object):
def __init__(self, ctx):
self.ctx = ctx
def find(self, *args):
logger.info('DummyFinder args "%s"' % str(args))
logger.info('Original finder %s'
% self.ctx._original_element_finder )
return 'Dummy find'
class MyPlugin(LibraryComponent):
def __init__(self, ctx):
LibraryComponent.__init__(self, ctx)
ctx._original_element_finder = ElementFinder(ctx)
self.element_finder = DummyFinder(ctx)
@keyword
def new_keyword(self):
"""Adding new keyword."""
self.info('New Keyword')
return 'New Keyword'
@keyword()
def open_browser(self, location):
"""Overwrite existing keyword."""
self.info(location)
return location