【问题标题】:Robot Framework Run Keyword and Expect Error机器人框架运行关键字并预期错误
【发布时间】:2017-08-24 11:03:04
【问题描述】:

在 Robot Framework 中执行关键字“Run Keyword and expect Error”时遇到以下问题。

首先我尝试了这个:

run keyword and expect error    InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated  Input Text  ${indFNPatientHealth Link}  RCIGM_FN

它失败了。追溯是:

17:44:01.894    FAIL    InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=60.0.3112.101)
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)
17:44:01.894    FAIL    Expected error 'InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated' but got 'InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=60.0.3112.101)
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)
'.

所以我修改了复制包括会话信息和驱动程序信息在内的全文的预期错误。更新后的代码是:

run keyword and expect error    InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated \ \ (Session info: chrome=60.0.3112.101) \ \ (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)    Input Text    ${indFNPatientHealth Link}    RCIGM_FN

然后又失败了。

17:31:59.291    FAIL    InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=60.0.3112.101)
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)
17:31:59.291    FAIL    Expected error 'InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated   (Session info: chrome=60.0.3112.101)   (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)' but got 'InvalidElementStateException: Message: invalid element state: Element is not currently interactable and may not be manipulated
  (Session info: chrome=60.0.3112.101)
  (Driver info: chromedriver=2.30.477700 (0057494ad8732195794a7b32078424f92a5fce41),platform=Windows NT 6.1.7601 SP1 x86_64)

提前感谢您对解决此问题的支持。

【问题讨论】:

    标签: python python-2.7 robotframework


    【解决方案1】:

    您要捕获的字符串很长、可变并且包含跳行。此外,调试数据与您的测试无关。如果我是你,我会捕获整个消息,将* 传递给Run Keyword And Expect Error,然后使用部分字符串匹配关键字来确保我捕获到InvalidElementStateException 异常。您也可以将您的消息添加到部分检查中,但删除变量调试数据。

    Run Keyword And Expect Error

    类似的东西

    ${msg}=    Run Keyword And Expect Error    *    Input Text    ${indFNPatientHealth Link}    RCIGM_FN
    Should Contain    ${msg}    InvalidElementStateException
    

    【讨论】:

      猜你喜欢
      • 2015-11-07
      • 2021-08-15
      • 2020-11-06
      • 1970-01-01
      • 2020-09-25
      • 2013-11-08
      • 2016-12-17
      • 1970-01-01
      • 2020-05-03
      相关资源
      最近更新 更多