Skip to content
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 With JupyterLab Menu File, Log Out fails with JavaScript exception in JupyterHub environment #45

Closed
lugi0 opened this issue Dec 20, 2021 · 3 comments

Comments

@lugi0
Copy link
Contributor

lugi0 commented Dec 20, 2021

As the title explains, running the Open With JupyterLab Menu keyword with File, Log Out arguments fails with the following JavaScript exception:

JavascriptException: Message: javascript error: Failed to execute 'elementsFromPoint' on 'Document': The provided double value is non-finite.

The issue seems to be that the locator used by the Click JupyterLab Menu Item keyword returns two hits when using Log Out as the argument in a JupyterHub environment (i.e. the hub:logout element is active instead of the filemenu:logout one).
In a single-user environment (i.e. the filemenu:logout element is active) the issue does not appear (because the hidden hub:logout element does not have the Log Out text).

There could be a number of ways to solve this issue, but before sending a PR I would like to get feedback on what would be the preferred solution. My current idea is to do a check on the ${label} passed to the keyword, and in the case of Log Out update the locator used to this:
//div[contains(@class, 'p-Menu-itemLabel')][text() = 'Log Out']/..[not(contains(@class,'p-mod-disabled'))]

The ..[not(contains(@class,'p-mod-disabled'))] part will filter out the inactive element out of the two, and will work in both environments.

This could also be used for all inputs, as it should not break any existing functionality and will handle any ${label} that happens to exist twice; I have however not tested this yet on such a large scale.

@bollwyvl
Copy link
Collaborator

..[not(contains(@class,'p-mod-disabled'))]

Yeah, that seems like a fine option for all of the menu stuff. I had some other stuff I was working not too long ago that ran into some related stuff, but don't remember how i worked around it. PR away, and i promise to be more responsive on reviewing that (and or #44).

@lugi0
Copy link
Contributor Author

lugi0 commented Dec 21, 2021

Hey @bollwyvl , no worries.
I've opened a PR (#46) for this, and when I have some time will also go back to the PR for #44.
I've tested the new locator with a bunch of menu items and couldn't find anything breaking, but let me know if you want any other changes.

@bollwyvl
Copy link
Collaborator

bollwyvl commented Dec 22, 2021

Just merged #46: you'll be able to pull the release sdist/wheel/conda package off the build of master, if you like, so you can assess if it meets your needs in a more "production" environment... and re-open if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants