|
| 1 | +from SeleniumLibrary import SeleniumLibrary |
| 2 | +from SeleniumLibrary.base import keyword, LibraryComponent |
| 3 | +from SeleniumLibrary.keywords import BrowserManagementKeywords |
| 4 | + |
| 5 | + |
| 6 | +class BrowserKeywords(LibraryComponent): |
| 7 | + |
| 8 | + def __init__(self, ctx): |
| 9 | + LibraryComponent.__init__(self, ctx) |
| 10 | + |
| 11 | + @keyword |
| 12 | + def open_browser(self, host): |
| 13 | + url = 'http://{}.com/'.format(host) |
| 14 | + browser_management = BrowserManagementKeywords(self.ctx) |
| 15 | + browser_management.open_browser(url, 'chrome') |
| 16 | + |
| 17 | + |
| 18 | +class DesiredCapabilitiesKeywords(LibraryComponent): |
| 19 | + |
| 20 | + def __init__(self, ctx): |
| 21 | + LibraryComponent.__init__(self, ctx) |
| 22 | + |
| 23 | + @keyword |
| 24 | + def get_browser_desired_capabilities(self): |
| 25 | + self.info('Getting currently open browser desired capabilities') |
| 26 | + return self.driver.desired_capabilities |
| 27 | + |
| 28 | + |
| 29 | +class Decomposition(SeleniumLibrary): |
| 30 | + |
| 31 | + def __init__(self, timeout=5.0, implicit_wait=0.0, |
| 32 | + run_on_failure='Capture Page Screenshot', |
| 33 | + screenshot_root_directory=None): |
| 34 | + SeleniumLibrary.__init__(self, timeout=timeout, implicit_wait=implicit_wait, |
| 35 | + run_on_failure=run_on_failure, |
| 36 | + screenshot_root_directory=screenshot_root_directory) |
| 37 | + self.add_library_components([BrowserKeywords(self), |
| 38 | + DesiredCapabilitiesKeywords(self)]) |
0 commit comments