selenium SyntaxError:Unexpected identifierエラー

731 ワード

seleniumの使用中にエラーがトリガーされた理由
selenium.common.exceptions.WebDriverException: Message: unknown error: Runtime.evaluate threw exception: SyntaxError: Unexpected identifier
例:
css_a = ''
driver.execute_script(
    "document.getElementById('{id}').outerHTML = '{content}';".format(id="vehicleLicenseCodeId", content=css_a))

注意赤の二重引用符は、一重引用符に切り替えるとエラーが解決し、一重引用符は二重引用符に変更されます.