Good morning everybody, I am writing for you to help me for a method that contains an error.
I am trying to automatize a test for writing a text on a document.body.innerHTML with the method executeJavascript but it's block in a code line. What can I do to fix this error :
"org.openqa.selenium.JavascriptException: SyntaxError: unexpected token: identifier".
Thanks for your help. Here is my part of the code:
public void publishCommentInFeedback(String commentTxt) {
JLearnSelectorUtils
.findElementByCssSelector(".comment-pane .dbcomment-add A").click();
ActionUtils.switchToFrame(
JLearnSelectorUtils.findElementByCssSelector(".new-comment-container IFRAME")
);
ActionUtils
.executeJavascript("document.body.innerHTML = '" + commentTxt + "'");
ActionUtils.switchToDefaultContent();
JLearnSelectorUtils.findElementByCssSelector(".new-comment-container .btn").click();
ActionUtils.waitUntilElementVisible(60, ".fulldisplay-footer .wysiwyg-editor");
}
Missing
;at the end of the script:vs
A different approach to find the body element: