【问题标题】:FAIL Error Tried to do playwright action, bu no open pageFAIL 错误试图做编剧动作,但没有打开页面
【发布时间】:2021-12-08 02:40:19
【问题描述】:

使用 RobotFramework,使用“浏览器”库。

使用代码:

*** Settings ***
Library    Browser  enable_presenter_mode=True
Library    XML
Library    Collections
Library    String
Library    DateTime

Documentation     FUTURE CHRISTMAS
*** Variables ***
${Date}=  2023-12-25 00:00:00.000000

*** Test Cases ***
Find the future christmasday
    Open Browser    https://obstaclecourse.tricentis.com/Obstacles/21269
    sleep  3s
    
[Arguments] ${Date}
    ${Day}=    Convert Date    ${Date}    result_format=%A
#    [Return]   ${Day}
    #${date2}=  DateTime.Get Current Date
    #Log To Console    ${Day}
    #Log To Console    ${date2}
    Click  id=christmasday
    Fill Text    id=christmasday    ${Day}
    Sleep    2s
    # used resources :
    # https://stackoverflow.com/questions/42356100/how-can-i-retrieve-the-day-of-the-week-from-date
    # 

它导致消息:

==============================================================================
Test5 21269 :: FUTURE CHRISTMAS                                               
==============================================================================
[ WARN ] Open Browser is for quick experimentation and debugging only. Use New Page for production.
Find the future christmasday                                          | PASS |
------------------------------------------------------------------------------
[ WARN ] Keyword 'Take Screenshot' could not be run on failure:
Error: Tried to take screenshot, but no page was open.
[Arguments] 2023-12-25 00:00:00.000000                                
[ FAIL ] Error: Tried to do playwright action, but no open page.

有一个打开的页面,我不知道错误消息来自哪里。

【问题讨论】:

  • 这是实际的完整来源吗?如果是这样,您在测试用例部分中有一个[Arguments],这是不合适的;它可能导致错误。

标签: browser robotframework


【解决方案1】:

如果这是您的实际代码,则以[Arguments] ${Date} 开头的行被认为是测试用例的名称,因为它位于左边距。在该测试用例中,您还没有打开浏览器,因此出现了错误。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    • 2019-05-12
    • 2021-02-25
    • 1970-01-01
    • 2022-08-02
    • 1970-01-01
    相关资源
    最近更新 更多