diff --git a/src/JupyterLibrary/clients/jupyterlab/Output.resource b/src/JupyterLibrary/clients/jupyterlab/Output.resource index dff53aaa..da14327f 100644 --- a/src/JupyterLibrary/clients/jupyterlab/Output.resource +++ b/src/JupyterLibrary/clients/jupyterlab/Output.resource @@ -41,3 +41,16 @@ Screenshot Each Output Of Active JupyterLab Document Screenshot Each Output Of Active JupyterLab Cell ${prefix}_cell_${i} Screenshot Markdown Of Active JupyterLab Cell ${prefix}_cell_${i} END + +Wait Until JupyterLab Code Cell Is Idle + [Documentation] Waits until the given cell in a specific JL tab no longer has an active prompt "[*]:". + ... The cell index starts from 1 and you must count empty and markdown cells too. + [Arguments] ${tab_id_to_wait} ${cell_n} ${timeout}=30 + Wait Until Element Is Not Visible xpath=//div[@aria-labelledby="${tab_id_to_wait}"]/${JLAB XP NOTEBOOK CONTENT}/div[${cell_n}]/${JLAB XP CELL INPUT STATUS ICON} ${timeout} + +Get A JupyterLab Code Cell Output In a Given Tab + [Documentation] It returns the output of a given cell in a specific JL tab. + ... The cell index starts from 1 and you must count empty and markdown cells too. + [Arguments] ${tab_id_to_read} ${cell_n} + ${output_children}= Get Web Elements xpath=//div[@aria-labelledby="${tab_id_to_read}"]/${JLAB XP NOTEBOOK CONTENT}/div[${cell_n}]/${JLAB XP CELL OUTPUT GENERIC} + [Return] ${output_children} \ No newline at end of file diff --git a/src/JupyterLibrary/clients/jupyterlab/Selectors.resource b/src/JupyterLibrary/clients/jupyterlab/Selectors.resource index 5d23f4de..1db89f8c 100644 --- a/src/JupyterLibrary/clients/jupyterlab/Selectors.resource +++ b/src/JupyterLibrary/clients/jupyterlab/Selectors.resource @@ -40,5 +40,16 @@ ${JLAB XP NB TOOLBAR} //div${JLAB XP NB TOOLBAR FRAG} ${JLAB XP BUSY KERNEL} //*[local-name() = 'div' and contains(@class, 'jp-FilledCircleIcon' or (local-name() = 'svg' and contains(@data-icon, 'ui-components:circle-filled')))] # dock panel ${JLAB XP DOCK PANEL} //*[@id = 'jp-main-dock-panel'] -${JLAB XP DOCK TAB} ${JLAB XP DOCK PANEL}//ul[contains(@class, 'p-TabBar-content')]/li[contains(@class, 'p-TabBar-tab')] +${JLAB XP DOCK TABBAR CONTENT} ${JLAB XP DOCK PANEL}//ul[contains(@class, 'p-TabBar-content')] +${JLAB XP DOCK TAB} ${JLAB XP DOCK TABBAR CONTENT}/li[contains(@class, 'p-TabBar-tab')] ${JLAB XP DOCK TAB LABEL} ${JLAB XP DOCK TAB}/div[contains(@class, 'p-TabBar-tabLabel')] +${JLAB XP DOCK TAB SELECTED} ${JLAB XP DOCK TABBAR CONTENT}/li[contains(@class,"lm-mod-current p-mod-current")] +# notebook +${JLAB XP CELL INPUT AREA} div[contains(@class, "p-Cell-inputWrapper")]/div[contains(@class,"jp-Cell-inputArea")] +${JLAB XP CELL INPUT STATUS ICON} ${JLAB XP CELL INPUT AREA}/div[contains(@class,"jp-InputArea-prompt") and (.="[*]:")] +${JLAB XP CELL OUTPUT AREA} div[contains(@class, "jp-Cell-outputWrapper")]/div[contains(@class,"jp-Cell-outputArea")] +${JLAB XP CELL OUTPUT TEXT} ${JLAB XP CELL OUTPUT AREA}//div[contains(@class,"jp-RenderedText")] +${JLAB XP CELL OUTPUT GENERIC} ${JLAB XP CELL OUTPUT AREA}//div[contains(@class,"jp-Rendered")] +${JLAB XP NOTEBOOK CONTENT} div[contains(@class, "jp-NotebookPanel-notebook")] + + diff --git a/src/JupyterLibrary/clients/jupyterlab/Shell.resource b/src/JupyterLibrary/clients/jupyterlab/Shell.resource index a11f6a99..1ee1469d 100644 --- a/src/JupyterLibrary/clients/jupyterlab/Shell.resource +++ b/src/JupyterLibrary/clients/jupyterlab/Shell.resource @@ -78,3 +78,15 @@ Close JupyterLab Dock Panel Tab [Arguments] ${label} ${n}=1 ${tab} = Get JupyterLab Dock Panel Tab ${label} ${n} Click Element ${tab.find_element_by_xpath('./div[last()]')} + +Get Selected JupyterLab Dock Panel Tab + [Documentation] Return the web element of selected notebook tab and its tab id + ... It can be handful when working with more than one notebook file at time. + ${selected_nb_tab} = Get WebElement xpath:${JLAB XP DOCK TAB SELECTED} + ${tab_id} = Get Element Attribute ${selected_nb_tab} id + [Return] ${selected_nb_tab} ${tab_id} + +Select JupyterLab Dock Panel Tab By FilePath + [Documentation] Select a notebook tab by filepath. + [Arguments] ${filepath} + Click Element xpath:${JLAB XP DOCK TABBAR CONTENT}/li[contains(@title, "${filepath}")]