def __init__(self, timeout="10s", enable_playwright_debug: bool = False): """Browser library can be taken into use with optional arguments: - ``timeout``: Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. - ``enable_playwright_debug``: Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. """ self.ROBOT_LIBRARY_LISTENER = self # This is more explicit than to have all the libraries be referenceable when they don't need it. self.browser_control = Control(self) self.promises = Promises(self) libraries = [ self.browser_control, Evaluation(self), Input(self), Getters(self), PlaywrightState(self), Network(self), self.promises, Waiter(self), WebAppState(self), ] self.playwright = Playwright(timeout, enable_playwright_debug) DynamicCore.__init__(self, libraries)
def __init__( self, visible: bool = True, timeout: int = 30, wait_time: float = 0.5, wait_time_after_write: float = 0.0, img_folder: str = ".", run_on_failure_keyword: str = "Take Screenshot", ) -> None: """ By default the emulator visibility is set to visible=True. In this case test cases are executed using wc3270 (Windows) or x3270 (Linux/MacOSX). You can change this by setting visible=False. Then test cases are run using ws3720 (Windows) or s3270 (Linux/MacOS). This is useful when test cases are run in a CI/CD-pipeline and there is no need for a graphical user interface. Timeout, waits and screenshot folder are set on library import as shown above. However, they can be changed during runtime. To modify the ``wait_time``, see `Change Wait Time`, to modify the ``img_folder``, see `Set Screenshot Folder`, and to modify the ``timeout``, see the `Change Timeout` keyword. By default, Mainframe3270 will take a screenshot on failure. You can overwrite this to run any other keyword by setting the ``run_on_failure_keyword`` option. If you pass ``None`` to this argument, no keyword will be run. To change the ``run_on_failure_keyword`` during runtime, see `Register Run On Failure Keyword`. """ self._running_on_failure_keyword = False self.register_run_on_failure_keyword(run_on_failure_keyword) libraries = [ x3270(visible, timeout, wait_time, wait_time_after_write, img_folder) ] DynamicCore.__init__(self, libraries)
def __init__(self, resources): """ - ``resources``: semicolon separated list of python packages to scan for robotframework resource files """ DynamicCore.__init__(self, []) self.resources = [] try: self.rf = BuiltIn() except RobotNotRunningError: pass self.modules = self._find_modules() for resource in resources.split(";"): if resource in self.modules: resource_files = self._find_resources(self.modules[resource]) if resource_files: for resource_file in resource_files: try: self.rf.import_resource(resource_file) except RobotNotRunningError: pass self.resources.append(resource_file) else: logger.warn( f"Module {resource} did't contain any resource files") else: logger.warn( f"Module {resource} doesn't contain resource directory: {self.RESOURCE_PATH}" )
def __init__(self, arg=None): """Library init doc.""" components = [librarycomponents, librarycomponents.Names(), librarycomponents.Arguments(), librarycomponents.DocsAndTags()] DynamicCore.__init__(self, components) self.instance_attribute = 'not keyword'
def __init__( self, timeout: timedelta = timedelta(seconds=10), enable_playwright_debug: bool = False, auto_closing_level: AutoClosingLevel = AutoClosingLevel.TEST, retry_assertions_for: timedelta = timedelta(seconds=1), run_on_failure: str = "Take Screenshot", ): """Browser library can be taken into use with optional arguments: - ``timeout`` <str> Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds. - ``enable_playwright_debug`` <bool> Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. - ``auto_closing_level`` < ``SUITE`` | ``TEST`` | ``MANUAL`` > Configure context and page automatic closing. Default is after each test. Other options are SUITE for closing after each suite and MANUAL for no automatic closing. - ``retry_assertions_for`` <str> Timeout for retrying assertions on keywords before failing the keywords. This timeout starts counting from the first failure. Global ``timeout`` will still be in effect. This allows stopping execution faster to assertion failure when element is found fast. - ``run_on_failure`` <str> Sets the keyword to execute in case of a failing Browser keyword. It can be the name of any keyword that does not have any mandatory argument. If no extra action should be done after a failure, set it to ``None`` or any other robot falsy value. """ self.timeout = self.convert_timeout(timeout) self.retry_assertions_for = self.convert_timeout(retry_assertions_for) self.ROBOT_LIBRARY_LISTENER = self self._execution_stack: List[object] = [] self._running_on_failure_keyword = False self._pause_on_failure = set() self.run_on_failure_keyword = (None if is_falsy(run_on_failure) else run_on_failure) self._unresolved_promises: Set[Future] = set() self._playwright_state = PlaywrightState(self) libraries = [ self._playwright_state, Control(self), Cookie(self), Devices(self), Evaluation(self), Interaction(self), Getters(self), Network(self), RunOnFailureKeywords(self), Promises(self), Waiter(self), WebAppState(self), ] self.playwright = Playwright(self, enable_playwright_debug) self._auto_closing_level = auto_closing_level self.current_arguments = () DynamicCore.__init__(self, libraries)
def __init__(self): self._database = None libraries = [ KeePassDatabase(self), KeePassEntry(self), KeePassEntries(self), KeePassGroup(self), KeePassGroups(self) ] DynamicCore.__init__(self, libraries)
def __init__( self, timeout="10s", enable_playwright_debug: bool = False, auto_closing_level: AutoClosingLevel = AutoClosingLevel.TEST, assertion_polling_enabled: bool = True, ): """Browser library can be taken into use with optional arguments: - ``timeout`` <str> Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds. - ``enable_playwright_debug`` <bool> Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. - ``auto_closing_level`` <SUITE|TEST|MANUAL> Configure context and page automatic closing. Default is after each test. Other options are SUITE for closing after each suite and MANUAL for no automatic closing. - ``assertion_polling_enabled`` <bool> Disable assertion polling by setting this flag to false. """ self.timeout = timeout self.assertion_polling_enabled = assertion_polling_enabled self.ROBOT_LIBRARY_LISTENER = self self._execution_stack: List[object] = [] self._unresolved_promises: Set[Future] = set() self._playwright_state = PlaywrightState(self) libraries = [ Control(self), Cookie(self), Devices(self), Evaluation(self), Interaction(self), Getters(self), self._playwright_state, Network(self), Promises(self), Waiter(self), WebAppState(self), ] self.playwright = Playwright(self, enable_playwright_debug) self._auto_closing_level = auto_closing_level DynamicCore.__init__(self, libraries)
def __init__( self, timeout="10s", enable_playwright_debug: bool = False, auto_closing_level: AutoClosingLevel = AutoClosingLevel.TEST, ): """Browser library can be taken into use with optional arguments: - ``timeout`` <str> Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds. - ``enable_playwright_debug`` <bool> Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. - ``auto_closing_level`` <SUITE|TEST|MANUAL> Configure context and page automatic closing. Default is after each test. Other options are SUITE for closing after each suite and MANUAL for no automatic closing. """ self.timeout = timeout self.ROBOT_LIBRARY_LISTENER = self self._execution_stack: List[object] = [] # This is more explicit than to have all the libraries be referenceable when they don't need it. self.browser_control = Control(self) self.promises = Promises(self) self.getters = Getters(self) self.playwright_state = PlaywrightState(self) libraries = [ self.browser_control, Cookie(self), Devices(self), Evaluation(self), Interaction(self), self.getters, self.playwright_state, Network(self), self.promises, Waiter(self), WebAppState(self), ] self.playwright = Playwright(self, enable_playwright_debug) self._auto_closing_level = auto_closing_level DynamicCore.__init__(self, libraries)
def __init__(self): DynamicCore.__init__(self, []) self.ROBOT_LIBRARY_LISTENER = self # inputs self.descriptor_file = None self.suite_source = None self.parsed_descriptor = None # Suite config self.deployment_name = None self.orchestrator = None # Test case config self.sut = SUT(None, None, None) self.deployment_options = { 'SKIP_UNDEPLOY': False, 'USE_DEPLOYMENT': None } self.test_volume = None self.sidecar = None self.services = [] self.containers = [] # keep state of test self.context = None self.test_cases = [] self.current_keywords = [] self.fatal_error = False self.validation_attempted = False try: self.deployment_options['USE_DEPLOYMENT'] = \ (Settings.use_deployment or BuiltIn().get_variable_value("${USE_DEPLOYMENT}") or '').strip('\'') if (self.deployment_options['USE_DEPLOYMENT'] or BuiltIn().get_variable_value("${SKIP_UNDEPLOY}") or Settings.skip_undeploy): self.deployment_options['SKIP_UNDEPLOY'] = True except RobotNotRunningError: pass
def __init__( self, timeout: timedelta = timedelta(seconds=10), enable_playwright_debug: bool = False, auto_closing_level: AutoClosingLevel = AutoClosingLevel.TEST, retry_assertions_for: timedelta = timedelta(seconds=1), run_on_failure: str = "Take Screenshot fail-screenshot-{index}", external_browser_executable: Optional[Dict[SupportedBrowsers, str]] = None, jsextension: Optional[str] = None, enable_presenter_mode: Union[HighLightElement, bool] = False, playwright_process_port: Optional[int] = None, strict: bool = True, ): """Browser library can be taken into use with optional arguments: - ``timeout`` <str> Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds. - ``enable_playwright_debug`` <bool> Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. - ``auto_closing_level`` < ``TEST`` | ``SUITE`` | ``MANUAL`` > Configure context and page automatic closing. Default is ``TEST``, for more details, see `AutoClosingLevel` - ``retry_assertions_for`` <str> Timeout for retrying assertions on keywords before failing the keywords. This timeout starts counting from the first failure. Global ``timeout`` will still be in effect. This allows stopping execution faster to assertion failure when element is found fast. - ``run_on_failure`` <str> Sets the keyword to execute in case of a failing Browser keyword. It can be the name of any keyword. If the keyword has arguments those must be separated with two spaces for example ``My keyword \\ arg1 \\ arg2``. If no extra action should be done after a failure, set it to ``None`` or any other robot falsy value. Run on failure is not applied when library methods are executed directly from Python. - ``external_browser_executable`` <Dict <SupportedBrowsers, Path>> Dict mapping name of browser to path of executable of a browser. Will make opening new browsers of the given type use the set executablePath. Currently only configuring of `chromium` to a separate executable (chrome, chromium and Edge executables all work with recent versions) works. - ``jsextension`` <str> Path to Javascript module exposed as extra keywords. Module must be in CommonJS. - ``enable_presenter_mode`` <bool | dict> Automatic highlights to interacted components, slowMo and a small pause at the end. Can be enabled by giving True or can be customized by giving a dictionary: `{"duration": "2 seconds", "width": "2px", "style": "dotted", "color": "blue"}` Where `duration` is time format in Robot Framework format, defaults to 2 seconds. `width` is width of the marker in pixels, defaults the `2px`. `style` is the style of border, defaults to `dotted`. `color` is the color of the marker, defaults to `blue`. - ``strict`` <bool> If keyword selector points multiple elements and keywords should interact with one element, keyword will fail if ``strict`` mode is true. Strict mode can be changed individually in keywords or by ```et Strict Mode`` keyword. """ self.timeout = self.convert_timeout(timeout) self.retry_assertions_for = self.convert_timeout(retry_assertions_for) self.ROBOT_LIBRARY_LISTENER = self self._execution_stack: List[dict] = [] self._running_on_failure_keyword = False self._pause_on_failure: Set["Browser"] = set() self.external_browser_executable: Dict[SupportedBrowsers, str] = ( external_browser_executable or {} ) self._unresolved_promises: Set[Future] = set() self._playwright_state = PlaywrightState(self) libraries = [ self._playwright_state, Control(self), Cookie(self), Crawling(self), Devices(self), Evaluation(self), Formatter(self), Interaction(self), Getters(self), Network(self), RunOnFailureKeywords(self), StrictMode(self), Promises(self), Waiter(self), WebAppState(self), ] self.playwright = Playwright( self, enable_playwright_debug, playwright_process_port ) self._auto_closing_level = auto_closing_level self.current_arguments = () if jsextension is not None: libraries.append(self._initialize_jsextension(jsextension)) self.presenter_mode = enable_presenter_mode self.strict_mode = strict self._keyword_formatters: dict = {} DynamicCore.__init__(self, libraries) # Parsing needs keywords to be discovered. self.run_on_failure_keyword = self._parse_run_on_failure_keyword(run_on_failure)
def __init__( self, timeout=timedelta(seconds=5), implicit_wait=timedelta(seconds=0), run_on_failure="Capture Page Screenshot", screenshot_root_directory: Optional[str] = None, plugins: Optional[str] = None, event_firing_webdriver: Optional[str] = None, ): """SeleniumLibrary can be imported with several optional arguments. - ``timeout``: Default value for `timeouts` used with ``Wait ...`` keywords. - ``implicit_wait``: Default value for `implicit wait` used when locating elements. - ``run_on_failure``: Default action for the `run-on-failure functionality`. - ``screenshot_root_directory``: Path to folder where possible screenshots are created or EMBED. See `Set Screenshot Directory` keyword for further details about EMBED. If not given, the directory where the log file is written is used. - ``plugins``: Allows extending the SeleniumLibrary with external Python classes. - ``event_firing_webdriver``: Class for wrapping Selenium with [https://seleniumhq.github.io/selenium/docs/api/py/webdriver_support/selenium.webdriver.support.event_firing_webdriver.html#module-selenium.webdriver.support.event_firing_webdriver|EventFiringWebDriver] """ self.timeout = _convert_timeout(timeout) self.implicit_wait = _convert_timeout(implicit_wait) self.speed = 0.0 self.run_on_failure_keyword = RunOnFailureKeywords.resolve_keyword( run_on_failure) self._running_on_failure_keyword = False self.screenshot_root_directory = screenshot_root_directory self._resolve_screenshot_root_directory() self._element_finder = ElementFinder(self) self._plugin_keywords = [] libraries = [ AlertKeywords(self), BrowserManagementKeywords(self), CookieKeywords(self), ElementKeywords(self), FormElementKeywords(self), FrameKeywords(self), JavaScriptKeywords(self), RunOnFailureKeywords(self), ScreenshotKeywords(self), SelectElementKeywords(self), TableElementKeywords(self), WaitingKeywords(self), WindowKeywords(self), ] self.ROBOT_LIBRARY_LISTENER = LibraryListener() self._running_keyword = None self.event_firing_webdriver = None if is_truthy(event_firing_webdriver): self.event_firing_webdriver = self._parse_listener( event_firing_webdriver) self._plugins = [] if is_truthy(plugins): plugin_libs = self._parse_plugins(plugins) self._plugins = plugin_libs libraries = libraries + plugin_libs self._drivers = WebDriverCache() DynamicCore.__init__(self, libraries)
def __init__( self, timeout: timedelta = timedelta(seconds=10), enable_playwright_debug: bool = False, auto_closing_level: AutoClosingLevel = AutoClosingLevel.TEST, retry_assertions_for: timedelta = timedelta(seconds=1), run_on_failure: str = "Take Screenshot", external_browser_executable: Optional[Dict[SupportedBrowsers, str]] = None, jsextension: Optional[str] = None, enable_presenter_mode: bool = False, ): """Browser library can be taken into use with optional arguments: - ``timeout`` <str> Timeout for keywords that operate on elements. The keywords will wait for this time for the element to appear into the page. Defaults to "10s" => 10 seconds. - ``enable_playwright_debug`` <bool> Enable low level debug information from the playwright tool. Mainly Useful for the library developers and for debugging purposes. - ``auto_closing_level`` < ``TEST`` | ``SUITE`` | ``MANUAL`` > Configure context and page automatic closing. Default is ``TEST``, for more details, see `AutoClosingLevel` - ``retry_assertions_for`` <str> Timeout for retrying assertions on keywords before failing the keywords. This timeout starts counting from the first failure. Global ``timeout`` will still be in effect. This allows stopping execution faster to assertion failure when element is found fast. - ``run_on_failure`` <str> Sets the keyword to execute in case of a failing Browser keyword. It can be the name of any keyword that does not have any mandatory argument. If no extra action should be done after a failure, set it to ``None`` or any other robot falsy value. - ``external_browser_executable`` <Dict <SupportedBrowsers, Path>> Dict mapping name of browser to path of executable of a browser. Will make opening new browsers of the given type use the set executablePath. Currently only configuring of `chromium` to a separate executable (chrome, chromium and Edge executables all work with recent versions) works. - ``jsextension`` <str> Path to Javascript module exposed as extra keywords. Module must be in CommonJS. - ``enable_presenter_mode`` <bool> Automatic highlights to interacted components, slowMo and a small pause at the end. """ self.timeout = self.convert_timeout(timeout) self.retry_assertions_for = self.convert_timeout(retry_assertions_for) self.ROBOT_LIBRARY_LISTENER = self self._execution_stack: List[dict] = [] self._running_on_failure_keyword = False self._pause_on_failure: Set["Browser"] = set() self.run_on_failure_keyword = (None if is_falsy(run_on_failure) else { "name": run_on_failure, "args": () }) self.external_browser_executable: Dict[SupportedBrowsers, str] = ( external_browser_executable or {}) self._unresolved_promises: Set[Future] = set() self._playwright_state = PlaywrightState(self) libraries = [ self._playwright_state, Control(self), Cookie(self), Crawling(self), Devices(self), Evaluation(self), Interaction(self), Getters(self), Network(self), RunOnFailureKeywords(self), Promises(self), Waiter(self), WebAppState(self), ] self.playwright = Playwright(self, enable_playwright_debug) self._auto_closing_level = auto_closing_level self.current_arguments = () if jsextension is not None: libraries.append(self._initialize_jsextension(jsextension)) self.presenter_mode = enable_presenter_mode DynamicCore.__init__(self, libraries)
def __init__(self, arg: str): DynamicCore.__init__(self, []) self.instance_attribute = 'not keyword' self.arg = arg
def __init__( self, runner=None, # type: Text config=None, # type: Text run_on_failure="Eyes Abort Async", ): # type: (...) -> None """ Initialize the EyesLibrary | =Arguments= | =Description= | | runner | Specify one of `web`, `web_ufg`, or `mobile_native` runners (by default `web`) | | config | Path to applitools.yaml (if no specify, trying to find it in test suite dir) | | run_on_failure | Specify keyword to run in case of failure (By default `Eyes Abort Async`) | """ # skip loading of dynamic libraries during doc generation if config is None: # try to find `applitools.yaml` in test directory robot_logger.warn( "No `config` set. Trying to find `applitools.yaml` in current path" ) config = "applitools.yaml" if runner is None: runner = SelectedRunner.web robot_logger.warn("No `runner` set. Using `web` runner.") robot_logger.console( "Running test suite with `{}` runner and `{}` config".format( runner, config)) self.run_on_failure_keyword = run_on_failure self._running_on_failure_keyword = False self._eyes_registry = EyesCache() self._batch_registry = {} # type: Dict[Text, BatchInfo] self._running_keyword = None self._configuration = None self._selected_runner = try_parse_runner(runner) if is_test_run(): self.current_library = self._try_get_library(self._selected_runner) suite_path = get_suite_path() self._configuration = try_parse_configuration( config, self._selected_runner, RobotConfiguration(), suite_path) validate_config(self._configuration) self.ROBOT_LIBRARY_LISTENER = LibraryListener(self) self._locator_converter = LocatorConverter(self) else: # hide objects that uses dynamic loading for generation of documentation self.current_library = None keywords = [ RunnerKeywords(self), SessionKeywords(self), CheckKeywords(self), TargetKeywords(self), CheckSettingsKeywords(self), ConfigurationKeywords(self), ] DynamicCore.__init__(self, keywords)
def __init__(self) -> None: libraries = [Library1(), Library2()] DynamicCore.__init__(self, libraries)
def __init__(self): self._keyword_formatters = {} DynamicCore.__init__(self, [Formatter(self)])
def __init__(self: "Helpers") -> None: DynamicCore.__init__(self, [])
def __init__(self): DynamicCore.__init__(self, [])
def __init__(self): self.ROBOT_LIBRARY_LISTENER = self DynamicCore.__init__(self, [])
def __init__(self): self.benchmarks = {} DynamicCore.__init__(self, [])