Skip to content

Possible bug in Maybe Accept a JupyterLab Prompt keyword #44

Open
@lugi0

Description

@lugi0

This keyword checks for a jupyterlab modal using a css selector, and, if found, tries clicking a button (the first one).

The problem seems to be that the selector returns an element every time, even when there's no modal open in the JL UI. In fact, using the dev console, I get two hits with that selector all the time.

The keyword does work when there's a modal/prompt open, but it will also fail whenever it is called and no prompt is available.

I believe that changing the selector from the css based one to an xpath one would solve this issue. Specifically, reworking the keyword like this is currently working fine for me:

[Documentation]    Click the save button in a JupyterLab dialog (if one is open).
    ${accept} =    Get WebElements    xpath://div[contains(concat(' ',normalize-space(@class),' '),' jp-Dialog-footer ')]
    Run Keyword If    ${accept}    Click Element    ${accept[-1]}

Note that I also changed from accept[0] to accept[-1], since the last button is usually the confirmation one (e.g. saving a file when closing it has three buttons, Dismiss, Cancel and Save in that order).

If you agree that the behaviour of the keyword is currently not working as expected I can open a PR to merge my changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions