Skip to content

Commit 0507996

Browse files
committed
add keywords for working with multiple open notebook tabs
1 parent 59b1d94 commit 0507996

File tree

3 files changed

+27
-0
lines changed

3 files changed

+27
-0
lines changed

src/JupyterLibrary/clients/jupyterlab/Notebook.robot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,14 @@ Run Current JupyterLab Code Cell
5151
... ${nb.find_element_by_xpath('''div${JLAB XP NB TOOLBAR FRAG}//${run icon}''')}
5252
Click Element ${run btn}
5353
Sleep 0.5s
54+
55+
Get Selected Tab ID
56+
[Documentation] Return the tab ID of the selected notebook tab
57+
${active-nb-tab} = Get WebElement xpath:${JL_TABBAR_SELECTED_XPATH}
58+
${tab-id} = Get Element Attribute ${active-nb-tab} id
59+
[Return] ${tab-id}
60+
61+
Select Tab By Name
62+
[Documentation] Select a notebook tab by filename
63+
[Arguments] ${filename}
64+
Click Element xpath:${JL_TABBAR_CONTENT_XPATH}/li/div[.="${filename}"]

src/JupyterLibrary/clients/jupyterlab/Output.robot

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,14 @@ Screenshot Each Output of Active JupyterLab Document
3939
Screenshot Each Output of Active JupyterLab Cell ${prefix}_cell_${i}
4040
Screenshot Markdown of Active JupyterLab Cell ${prefix}_cell_${i}
4141
END
42+
43+
Wait Until a Given JupyterLab Code Cell Is Not Active In a Given Tab
44+
[Documentation] Waits until the given cell in a specific JL tab no longer has an active prompt "[*]:".
45+
[Arguments] ${tab_id_to_wait} ${cell_n} ${timeout}=120seconds
46+
Wait Until Element Is Not Visible xpath=//div[@aria-labelledby="${tab_id_to_wait}"]/${NB TAB XP CONTENT}/div[${cell_n}]/${CELL XP INPUT STATUS ICON} ${timeout}
47+
48+
Get A JupyterLab Code Cell Output In a Given Tab
49+
[Documentation] It returns the output of a given cell in a specific JL tab
50+
[Arguments] ${tab_id_to_read} ${cell_n}
51+
${outputtext}= Get Text xpath=//div[@aria-labelledby="${tab_id_to_read}"]/${NB TAB XP CONTENT}/div[${cell_n}]/${CELL XP OUTPUT TEXT}
52+
[Return] ${outputtext}

src/JupyterLibrary/clients/jupyterlab/Selectors.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ ${JLAB XP NB FRAG} ${JLAB XP MAIN AREA FRAG}\[contains(@class, 'jp-NotebookPa
3131
${JLAB XP NB TOOLBAR FRAG} [contains(@class, 'jp-NotebookPanel-toolbar')]
3232
${JLAB XP NB TOOLBAR} //div${JLAB XP NB TOOLBAR FRAG}
3333
${JLAB XP BUSY KERNEL} //*[local-name() = 'div' and conttains(@class, 'jp-FilledCircleIcon' or (local-name() = 'svg' and contains(@data-icon, 'ui-components:circle-filled')))]
34+
${CELL XP INPUT} div[contains(@class, p-Cell-inputWrapper)]/div[contains(@class,"jp-Cell-inputArea")]
35+
${CELL XP INPUT STATUS ICON} ${CELL XP INPUT}/div[contains(@class,"jp-InputArea-prompt") and (.="[*]:")]
36+
${CELL XP OUTPUT} div[contains(@class, jp-Cell-outputWrapper)]/div[contains(@class,"jp-Cell-outputArea")]
37+
${CELL XP OUTPUT TEXT} ${CELL XP OUTPUT}//div[contains(@class,"jp-RenderedText")]
38+
${NB TAB XP CONTENT} div[@aria-label="notebook content"]
3439
## dock panel
3540
${JLAB XP DOCK PANEL} //*[@id = 'jp-main-dock-panel']
3641
${JLAB XP DOCK TAB} ${JLAB XP DOCK PANEL}//ul[contains(@class, 'p-TabBar-content')]/li[contains(@class, 'p-TabBar-tab')]

0 commit comments

Comments
 (0)