0

With RobotFramework, using the 'Browser' library.

using the code:

*** 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
    # 

It results in the message:

==============================================================================
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.

There's an open page, I have no clue where the error message comes from.

LTL
  • 339
  • 1
  • 9
  • 1
    Is that the actual and full source? If so, you have an `[Arguments]` in a test case section, which is out of place; it may be causing the error. – Todor Minakov Oct 21 '21 at 18:02

1 Answers1

1

If this is your actual code, the line that begins with [Arguments] ${Date} is considered to be the name of a test case since it is at the left margin. Inside that test case you haven't opened a browser, hence the error.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685