Using Selenium to Input Cypher Commands into Neo4j

  neo4j, python, selenium

So I am trying to automate query input into Neo4j browser. Since the area where the text is written into is not an input field, rather in <span> tags as below:
enter image description here

I would add in the the cypher command MATCH (n) RETURN n LIMIT 10 through python like this:

driver.execute_script('return document.getElementsByClassName("view-line")[0].outerHTML='<div style="top:0px;height:23px;" class="view-line"><span><span class="mtk4">MATCH</span><span class="mtk15">&nbsp;</span><span class="mtk3">(</span><span class="mtk15">n</span><span class="mtk3">)</span><span class="mtk15">&nbsp;</span><span class="mtk4">RETURN</span><span class="mtk15">&nbsp;n&nbsp;</span><span class="mtk4">LIMIT</span><span class="mtk15">&nbsp;</span><span class="mtk13">10</span></span></div>'')

After I edit the outer HTML using python and click the run button, the text would just disappear. I cannot figure out what could be wrong with this. I’m new to using selenium as well. So not sure if it is something that I am doing wrong.

Source: Python Questions

LEAVE A COMMENT