Log Many
关键字 :
Run Keyword And Ignore Error 关键字 :Name:Log ManySource:BuiltIn <test library>Arguments:[ *messages ]说明:Logs the given messages as separate entries with the INFO level.记录给定的消息作为与INFO级别单独的条目。
Name:Run Keyword And Ignore ErrorSource:BuiltIn <test library>Arguments:[ name | *args ]说明:Runs the given keyword with the given arguments and ignores possible error.运行与给定参数给定的关键字,而忽略可能出现的错误。This keyword returns two values, so that the first is either 'PASS' or 'FAIL', depending on the status of the executed keyword. The second value is either the return value of the keyword or the received error message. See `Run Keyword And Return Status` If you are only interested in the execution status.这个关键字返回两个值,使得第一要么是“PASS”或“FAIL”,这取决于所执行的关键字的状态。第二个值是关键字的任一返回值或接收到错误消息。请参阅`Run Keyword And Return Status`如果你只关心执行状态。The keyword name and arguments work as in `Run Keyword`. See `Run Keyword If` for a usage example.关键字名称和参数在执行`运行关键字`。见`Run Keyword If `的使用示例。Starting from Robot Framework 2.5 errors caused by invalid syntax, timeouts, or fatal exceptions are not caught by this keyword.执行Robot Framework 2.5 引起无效的语法,超时或致命异常错误时未捕获此关键字。
Log函数:
Name:LogSource:BuiltIn <test library>Arguments:[ message | level=INFO ]说明:Logs the given message with the given level.记录包含给定消息定的级别。Valid levels are TRACE, DEBUG, INFO (default), HTML and WARN.有效的级别是TRACE,DEBUG,INFO(默认),HTML和WARN。The HTML level is special because it allows writing messages without HTML code in them being escaped. For example, logging a message '<img src="image.png">' using the HTML level creates an image, but with other levels the message would be that exact string. Notice that invalid HTML can easily corrupt the whole log file so this feature should be used with care. The actual log level used for HTML messages is INFO.在HTML级别是特殊之处在于它不需要的HTML代码在其中所转义写入消息。例如,记录消息'<img src="image.png">“使用HTML级别创建一个图像,但与其他级别的消息将是精确的字符串。请注意,无效的HTML可以很容易损坏整个日志文件,所以此功能应小心使用。用于HTML邮件的实际日志级别为INFO。Messages logged with the WARN level will be visible also in the console and in the Test Execution Errors section in the log file.记录的WARN级别的消息将是可见也是在控制台和日志文件的测试执行错误部分。
Evalute
关键字
:
Name: EvaluateSource: BuiltIn <test library>Arguments: [ expression | modules=None ]Evaluates the given expression in Python and returns the results.评估输入的Python表达式并返回的结果`modules` argument can be used to specify a comma separated list of Python modules to be imported and added to the namespace of the evaluated `expression`.`modules` 参数可以用来指定Python模块名称,评估的的表达式使用的模块名称以逗号做分隔为列表,实例(expecting `${result}` is 3.14):${status} = Evaluate 0 < ${result} < 10${down} = Evaluate int(${result})${up} = Evaluate math.ceil(${result}) math${random} = Evaluate random.randint(0, sys.maxint) random,sys运行结果:${status} = True${down} = 3${up} = 4.0${random} = <random integer>请注意,该方法不是为了创建复杂的表达式,它建议将复杂逻辑移到一个测试库。
Assign Id To Element关键字:
Name:Assign Id To ElementSource:Selenium2Library <test library>Arguments:[ locator | id ]Assigns a temporary identifier to element specified by `locator`.分配的临时标识符由`locator`指定的元素。This is mainly useful if the locator is complicated/slow XPath expression. Identifier expires when the page is reloaded.这主要是有用的,如果该定位器是复杂/缓慢加载的XPath表达式。标识符到期时,页面重新加载。实例 :Assign ID to Element xpath=//div[@id="first_div"] my idPage Should Contain Element my id
Run Keyword And Expect Error关键字
Name:Run Keyword And Expect ErrorSource:BuiltIn <test library>Arguments:[ expected_error | name | *args ]Runs the keyword and checks that the expected error occurred.运行所发生的预期错误的关键字和检查。The expected error must be given in the same format as in Robot Framework reports. It can be a pattern containing characters '?', which matches to any single character and '*', which matches to any number of any characters. `name` and `*args` have same semantics as with `Run Keyword`.必须在相同的格式给出的预期误差为在 Robot Framework的报告。它可以是包含字符“?”的图案,它匹配于任何单个字符和“*”,它匹配到任意数量的任何字符。 `name`和`* args`具有相同的语义与`运行Keyword`。If the expected error occurs, the error message is returned and it can be further processed/tested, if needed. If there is no error, or the error does not match the expected error, this keyword fails.如果出现了预期的错误时,返回错误消息,如果需要的话,并可以进一步加工/测试。如果没有错误,或者错误不匹配预期错误,此关键字失败。Examples:Run Keyword And Expect Error My error Some Keyword arg1 arg2${msg} = Run Keyword And Expect Error * My KWShould Start With ${msg} Once upon a time inStarting from Robot Framework 2.5 errors caused by invalid syntax, timeouts, or fatal exceptions are not caught by this keyword.从 Robot Framework 2.5开始造成无效的语法错误,超时或致命的异常没有抓到这个关键字。