How to use recordVideo for New Context

Hello everyone,

I am having some difficulties passing recordVideo as an argument for New Context:
*** Keywords ***
launchBrowser
[Arguments] ${browser_url}
New Browser chromium headless=False
New Context
… tracing=./traces/traces.zip
… recordVideo={‘dir’: “./videos/video”}
… viewport={‘width’: 1750, ‘height’: 1080}
New Page ${browser_url}

I get this after running my script:
ValueError: Argument ‘recordVideo’ got value ‘{‘dir’: “./videos/video”, ‘size’: ‘width’: 1750, ‘height’: 1080}’ that cannot be converted to RecordVideo or None.

documentation says it should formatted this way:

Type: RecordVideo

Dictionary Structure

{
‘dir’:
‘size’:
}

Any help would be much appreciated.

You should use Create Dictionary keyword and pass dictionary parameter.

  Init Browser
    [Arguments]                ${browser_url}
    New Browser                chromium             headless=False
    &{recordVideo}             Create Dictionary    dir=./videos
    New Context
    ...                        recordVideo=${recordVideo}
    ...                        viewport={'width': 1750, 'height': 1080}

That did the trick, thank you so much ! @JaPyR

Viewport should be also set the same way using dictionary.