Skip to content

Improve popup handling #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/JupyterLibrary/clients/jupyterlab/Selectors.resource
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ ${JLAB XP NB FRAG} ${JLAB XP MAIN AREA FRAG}\[contains(@cla
${JLAB XP NB TOOLBAR FRAG} [contains(@class, 'jp-NotebookPanel-toolbar')]
${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')))]
${JLAB XP CONTENT XPATH} //div[contains(@class,"p-DockPanel-tabBar")]/ul[@class="p-TabBar-content"]
${JLAB XP NOT SELECTED XPATH} ${JLAB XP CONTENT XPATH}/li[not(contains(@class,"p-mod-current"))]
${JLAB POPUP} //div[contains(concat(' ',normalize-space(@class),' '),' jp-Dialog-footer ')]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the JLAB XP to this to distinguish it from the CSS selectors

# 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')]
Expand Down
19 changes: 16 additions & 3 deletions src/JupyterLibrary/clients/jupyterlab/Shell.resource
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,22 @@ Open With JupyterLab Menu
END

Maybe Accept A JupyterLab Prompt
[Documentation] Click the accept button in a JupyterLab dialog (if one is open).
${accept} = Get WebElements css:${JLAB CSS ACCEPT}
Run Keyword If ${accept} Click Element ${accept[0]}
[Documentation] Click the last button in a JupyterLab dialog (if one is open).
${accept} = Get WebElements xpath:${JLAB POPUP}
${len} = Get Length ${accept}
# Click the right most button of the popup
Run Keyword If ${accept} Click Element xpath:${JLAB POPUP}/button[last()]
[Return] ${len}

Maybe Accept All JupyterLab Prompts
[Documentation] Try accepting all JL popups.
${total} = Set Variable ${0}
FOR ${i} IN RANGE 9999999
${closed} = Maybe Accept A JupyterLab Prompt
${total} = ${total}+${closed}
Exit For Loop If ${closed}==0
END
[Return] ${total}

Get JupyterLab Dock Panel Tab
[Documentation] Get the ``n`` -th JupyterLab Dock Panel Tab with ``label`` as a ``WebElement``.
Expand Down