【发布时间】:2015-01-17 10:30:45
【问题描述】:
我正在使用 selenium 和 Python,我正在尝试执行一个 JS 函数,该函数接受如下字符串:
browser.execute_script("foo('someString')")
这在 someString 没有任何换行符时有效。 当有换行符时,会发生以下情况:
\n => Parse Error
\\n => Newline is converted to a space
\r\n => Parse Error
\\r\\n => Both characters are converted to a space
有没有办法做到这一点?
【问题讨论】:
标签: javascript python string selenium