title: How to use a python script to open a rendered HTML page in browser, wait for user key inputs/run javascript, return input information to python script
body: <p>I am trying to write a python script that launches an HTML page on a browser (or at least renders the HTML page/code graphically somehow), at which point the script waits for a series of user key inputs from the page in the browser- the key presses will change the css of some DOM elements and when an enter key is pressed, information about the 'currently selected' element will return to the python script and close the browser. This requires traversing the DOM element tree (which I can do with BeautifulSoup) WHILE re-rendering style of elements on a visible browser. </p>
  
  <p>I have been trying to find a library or webkit that lets me do this but I can only find headless tools... but it is necessary for this to have a visual display that a user can interact with. </p>
  
  <p>I think I can figure out how to do everything in parts but I'm confused about the overall structure of how to allow communication between a python script on my machine and a javascript script in a browser. Any guidance is appreciated!</p>