For the tests I am using notebook==7.0.2 and used various way to add something to the line like
nb_cell.find_elements(By.CLASS_NAME, "CodeMirror-line")[3].send_keys("a")
clicking workings. I am not sure if is related to osscar-org/widget-code-input#18
but with notebook==6.5.5 I get this error osscar-org/widget-code-input#20
The only thing that works with the WidgetCodeInput correctly is jupyter lab 3.*, but that is not so simple get running in the current testing environment.