I don't see browser even though headless mode is off

I don’t see the browser window during my tests even so the tests work fine and the screenshot show what should be there. Here is the code
resources:
*** Keywords ***
Generic Web Suite Setup
[Documentation] Global setup for all web related tests. Browser is started using this
New Browser browser=${BROWSER} headless=FALSE
Set Browser Timeout ${BROWSER_TIMEOUT}
Set Global Variable ${BROWSER_TIMEOUT}
Set Global Variable ${LOG_LEVEL} INFO

Generic Web Suite Teardown
    [Documentation]    Global teardown for web related tests. Browser is closed using this
    Browser.Close Browser

Generic Web Test Setup
    [Documentation]    Basic test setup for web related tests. Browser is configured here
    ${har} =    Create Dictionary    path=output/har.file    omitContent=True
    ${DEFAULT_CONTEXT} =    New Context    viewport={'width': 1920, 'height': 1080}    recordHar=${har}
    Set Global Variable    ${DEFAULT_CONTEXT}

Generic Web Test Teardown
    [Documentation]    Basic test teardown for web related tests.
    @{contexts} =    Get Context Ids
    FOR    @{context}    IN    @{contexts}
        Switch Context    @{context}
        Close Context
    END
    ${DEFAULT_CONTEXT}=    ${None}
    Set Global Variable    ${DEFAULT_CONTEXT}

  Open Trial As Admin
      [Documentation]    Open the Admin Login Page
      ${ADMIN_CONTEXT}=    New Context    viewport={'width': 1920, 'height': 1080}
      Set Global Variable    ${ADMIN_CONTEXT}
      New Page    url=${ADMIN_LOGIN_URL}
      Type Text    id=username    ${ENV['Site']['auth']['admin']['username']}
      Click    id=postButton
      Type Text    id=password    ${ENV['Site']['auth']['admin']['password']}
      Click    id=signOnButton
  
  Switch To Admin Context
      [Documentation]    Start workign as Trial Admin
      IF    ${ADMIN_CONTEXT}==${Null}    Open Trial As Admin
      Switch Context    ${ADMIN_CONTEXT}

The test goes here using the above resource

*** Settings ***
Resource            ${RESOURCES}/TrialMax/login.resource

Suite Setup         Generic Web Suite Setup
Suite Teardown      Generic Web Suite Teardown
Test Setup          Generic Web Test Setup
Test Teardown       Generic Web Test Teardown

*** Test Cases ***
Login As Admin
    Switch To Admin Context

When I use Open Browser instead of New Browser I am able to see the browser window.

Got it. For every new context you need to create a separate browser. Otherwise it is created automatically and default one is headless

1 Like