JupyterLibrary provides a few lightweight IPython magics for its own testing purposes.

If you like writing and executing Robot Framework Kernel, you might like a more full-featured experience:

In [ ]:
%reload_ext JupyterLibrary

The %%robot magic runs a cell of code as you would write in a .robot file. No funny stuff (by default).

In [ ]:
%%robot -o _static
*** Tasks ***
Log Something
    Log        Something

The interactive help is pretty good.

In [ ]:

Of note: you can specify extra arguments to with -a, the name of a local variable.

In [ ]:
args = dict(include=["mytag:a"])
In [ ]:
%%robot -a args -o _static
*** Tasks ***
Do thing A
    [Tags]   mytag:a
    Log   A

Do thing B
    [Tags]   mytag:b
    Log   B

Do thing AB
    [Tags]   mytag:a  mytag:b
    Log   AB

Running JupyterLibrary

The line below is a Markdown Cell... change it to a Code Cell to run it

*** Settings ***
Documentation     A nice task suite
Library           JupyterLibrary
Suite Setup       Wait for New Jupyter Server to be Ready
Test Teardown     Reset JupyterLab and Close
Suite Teardown    Run Keyword and Ignore Error   Terminate All Jupyter Servers

*** Tasks ***
A Notebook in JupyterLab
    Open JupyterLab
    Launch a new JupyterLab Document
    Add and Run JupyterLab Code Cell   print("hello" + " world")
    Wait Until page Contains   hello world
    Capture Page Screenshot  ran-code.png

With Widgets

There is some more stuff coming with %%robot, but for now, ipywidgets.interact can be used to quickly build UI around robot-generated artifacts

In [ ]:
from pathlib import Path
from IPython.display import display, Image

ipywidgets = None
    import ipywidgets
In [ ]:
if ipywidgets:
    def show_image(i=(0, 100)):
        all_images = sorted(Path("_robot_magic_").rglob("*.png"), key=lambda p: p.stat().st_mtime)
        if not all_images:
        start = all_images[0].stat().st_mtime
        i = min(len(all_images) - 1, i)
        img = all_images[i]
        delta = img.stat().st_mtime - start
        display(f"[{round(delta)}s][{i} of {len(all_images)}] {}", Image(img))