I’m trying to have Python run some Javascript, and I am running into a few issues. Namely that when I am trying to inject some text into a textarea of a page, it doesn’t seem to work if and only if there is a newline (\n) as part of the variable inserted for the Javascript.
Here’s my line:
br.runjs("document.getElementById('edit-body').value = '%s'" % (brag))
if the variable “brag” has any sort of newline in it at all, the insertion does not work. Any idea how to go around this?
Encode
bragas JSON and then use that.