Beispiel #1
0
    def __init__(self,
                 timeout=3.0,
                 newline='CRLF',
                 prompt=None,
                 prompt_is_regexp=False):
        """Telnet library can be imported with optional arguments.

        Initialization parameters are used as default values when new
        connections are opened with `Open Connection` keyword. They can also be
        set after opening the connection using the `Set Timeout`, `Set Newline` and
        `Set Prompt` keywords. See these keywords for more information.

        Examples (use only one of these):

        | *Setting* | *Value* | *Value* | *Value* | *Value* | *Value* | *Comment* |
        | Library | Telnet |     |    |     |    | # default values                |
        | Library | Telnet | 0.5 |    |     |    | # set only timeout              |
        | Library | Telnet |     | LF |     |    | # set only newline              |
        | Library | Telnet | 2.0 | LF |     |    | # set timeout and newline       |
        | Library | Telnet | 2.0 | CRLF | $ |    | # set also prompt               |
        | Library | Telnet | 2.0 | LF | ($|~) | True | # set prompt with simple regexp |
        """
        self._timeout = timeout == '' and 3.0 or timeout
        self._newline = newline == '' and 'CRLF' or newline
        self._prompt = (prompt, prompt_is_regexp)
        self._cache = utils.ConnectionCache()
        self._conn = None
        self._conn_kws = self._lib_kws = None
Beispiel #2
0
    def _atttelnet_init_(self, timeout='3 seconds', newline='CRLF', prompt=None,
                 prompt_is_regexp=False, encoding='UTF-8', default_log_level='INFO'):
        """Telnet library can be imported with optional configuration parameters.

        Configuration parameters are used as default values when new
        connections are opened with `Open Connection` keyword. They can also be
        overridden after opening the connection using the `Set Timeout`,
        `Set Newline`, `Set Prompt`, `Set Encoding`, and `Set Default Log Level`
        keywords. See these keywords and `Configuration` section above for more
        information about these parameters and their possible values.

        Examples (use only one of these):

        | *Setting* | *Value* | *Value* | *Value* | *Value* | *Value* | *Comment* |
        | Library | Telnet |     |    |     |    | # default values                |
        | Library | Telnet | 0.5 |    |     |    | # set only timeout              |
        | Library | Telnet |     | LF |     |    | # set only newline              |
        | Library | Telnet | newline=LF | encoding=ISO-8859-1 | | | # set newline and encoding using named arguments |
        | Library | Telnet | 2.0 | LF |     |    | # set timeout and newline       |
        | Library | Telnet | 2.0 | CRLF | $ |    | # set also prompt               |
        | Library | Telnet | 2.0 | LF | (> |# ) | True | # set prompt as a regular expression |
        """
        self._timeout = timeout or 3.0
        self._newline = newline or 'CRLF'
        self._prompt = (prompt, bool(prompt_is_regexp))
        self._encoding = encoding
        self._default_log_level = default_log_level
        self._cache = utils.ConnectionCache()
        self._conn = None
        self._conn_kws = self._lib_kws = None
Beispiel #3
0
    def __init__(self,
                 timeout=5.0,
                 server_host='localhost',
                 server_port=4444,
                 jar_path=None,
                 run_on_failure='Capture Screenshot'):
        """SeleniumLibrary can be imported with optional arguments.

        `timeout` is the default timeout used to wait for page load actions.
        It can be later set with `Set Selenium Timeout`

        `server_host` and `server_port` are used to connect to Selenium Server.
        Browsers opened with this SeleniumLibrary instance will be attached to
        that server. Note that the Selenium Server must be running before `Open
        Browser` keyword can be used. Selenium Server can be started with
        keyword `Start Selenium Server`. Starting from SeleniumLibrary 2.6.1,
        it is possible to give `server_host` as a URL with a possible embedded
        port, for example `http://192.168.52.1:4444`. If `server_host` contains
        port, the value of `server_port` is ignored.

        `jar_path` is the absolute path to the selenium-server.jar file to be
        used by the library. If set, a custom, modified version can be started
        instead of the default one distributed with the library.

        `run_on_failure` specifies the name of a SeleniumLibrary keyword to
        execute when another SeleniumLibrary keyword fails. By default
        `Capture Screenshot` will be used to take a screenshot of the situation.
        Using any value that is not a keyword name will disable this feature
        altogether. See `Register Keyword To Run On Failure` keyword for more
        information about this functionality that was added in SeleniumLibrary
        2.5.

        Because there are many optional arguments, it is often a good idea to
        use the handy named-arguments syntax supported by Robot Framework 2.5
        and later. This is demonstrated by the last two examples below.

        Examples:
        | Library | SeleniumLibrary | 15 | | | # Sets default timeout |
        | Library | SeleniumLibrary | | | 4455 | # Use default timeout and host but specify different port. |
        | Library | SeleniumLibrary | server_host=http://192.168.52.1:4444 | | | # Host as URL. |
        | Library | SeleniumLibrary | run_on_failure=Nothing | | | # Do nothing on failure. |
        """
        self._cache = utils.ConnectionCache()
        self._selenium = NoBrowserOpen()
        self.set_selenium_timeout(timeout or 5.0)
        self._server_host, self._server_port \
                = self._parse_host_and_port(server_host or 'localhost',
                                            server_port or 4444)
        self._jar_path = jar_path
        self._set_run_on_failure(run_on_failure)
        self._selenium_log = None
        self._locator_parser = LocatorParser(self)
        self._namegen = _NameGenerator()
Beispiel #4
0
    def __init__(self,
                 timeout='3 seconds',
                 newline='CRLF',
                 prompt=None,
                 prompt_is_regexp=False,
                 encoding='UTF-8',
                 encoding_errors='ignore',
                 default_log_level='INFO',
                 window_size=None,
                 environ_user=None,
                 terminal_emulation=False,
                 terminal_type=None):
        """Telnet library can be imported with optional configuration parameters.

        Configuration parameters are used as default values when new
        connections are opened with `Open Connection` keyword. They can also be
        overridden after opening the connection using the `Set Timeout`,
        `Set Newline`, `Set Prompt`, `Set Encoding`, and `Set Default Log Level`
        keywords. See these keywords as well as `Configuration` and
        `Terminal emulation` sections above for more information about these
        parameters and their possible values.

        Examples (use only one of these):

        | *Setting* | *Value* | *Value* | *Value* | *Value* | *Value* | *Comment* |
        | Library | Telnet |     |    |     |    | # default values                |
        | Library | Telnet | 0.5 |    |     |    | # set only timeout              |
        | Library | Telnet |     | LF |     |    | # set only newline              |
        | Library | Telnet | newline=LF | encoding=ISO-8859-1 | | | # set newline and encoding using named arguments |
        | Library | Telnet | 2.0 | LF |     |    | # set timeout and newline       |
        | Library | Telnet | 2.0 | CRLF | $ |    | # set also prompt               |
        | Library | Telnet | 2.0 | LF | (> |# ) | True | # set prompt as a regular expression |
        | Library | Telnet | terminal_emulation=True | terminal_type=vt100 | window_size=400x100 | | # use terminal emulation with defined window size and terminal type |
        """
        self._timeout = timeout or 3.0
        self._newline = newline or 'CRLF'
        self._prompt = (prompt, bool(prompt_is_regexp))
        self._encoding = encoding
        self._encoding_errors = encoding_errors
        self._default_log_level = default_log_level
        self._window_size = self._parse_window_size(window_size)
        self._environ_user = environ_user
        self._terminal_emulation = self._parse_terminal_emulation(
            terminal_emulation)
        self._terminal_type = terminal_type
        self._cache = utils.ConnectionCache()
        self._conn = None
        self._conn_kws = self._lib_kws = None
Beispiel #5
0
 def __init__(self):
     super(PreloadDataKeywords, self).__init__()
     self._cache = utils.ConnectionCache(
         'No Preload Data directories loaded')
     self.builtin = BuiltIn()
 def __init__(self):
     self._cache = utils.ConnectionCache('No Jinja Environments created')
Beispiel #7
0
 def __init__(self):
     super(KafkaKeywords, self).__init__()
     self._cache = utils.ConnectionCache('No Kafka Environments created')
Beispiel #8
0
 def __init__(self):
     super(ServiceMappingKeywords, self).__init__()
     self._cache = utils.ConnectionCache(
         'No Service Mappings directories loaded')