We use selenium for integration testing of our extensions. We used the following to send magic command to a code cell with Jupyterlab 3.X:
elem = DRIVER.find_element(By.CLASS_NAME, ‘jp-CodeConsole-input’)
.find_element(By.TAG_NAME, ‘textarea’)
elem.send_keys(input)
elem.send_keys(Keys.SHIFT, Keys.ENTER)
After we migrated to jupyterlab 4.2, tests started failing. ‘textarea’ not found.
Did not see ‘textarea’ when inspecting elements with developer tool.
any ideas how to fix this? Thanks!
CodeMirror 6 uses contenteditable on an (unclassed) container node, instead of the hidden textarea with overlays approach used by CodeMirror 5, representing an improvement in performance, portability and accessibility.
When porting robotframework-jupyterlibrary (which in turn uses robotframework-seleniumlibrary) to support Lab 4/Notebook 7, it certainly took a bit of doing to support both versions, settling on sniffing the underlying CodeMirror version and using the appropriate JS API directly.