3
$\begingroup$

I started web session and opened a Jupyter notebook in it:

session = StartWebSession["Chrome", Visible -> True]
WebExecute[session,{"OpenPage"->"http://localhost:8888/notebooks/Untitled1.ipynb"}]

In Chrome I had to input Token authentication to get to the notebook. Chrome looked like this then:

enter image description here

Then I execute the following code in Mathematica to find all textarea tags. It found three such tags as can be seen also on image above (three In).

textarea=WebExecute[session, "LocateElements" -> "Tag" -> "textarea"]

Then I wanted to insert different input to the first input cell in which we can see 7+6 on the image.

So I execute the following code in hoping it replaces 7+6 with 3*7:

WebExecute[session,"TypeElement"->{textarea[[1]],"3*7"}]

But I got error:

enter image description here

Why it does not work? How to insert text inside input cell of Jupyter notebook using WebExecute?

The HTML of textarea tag looked liked this:

<textarea autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="0" style="position: absolute; bottom: -1em; padding: 0px; width: 1000px; height: 1em; outline: none;"></textarea>
$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.