0

I'm working on selenium and I have to automate tinyMCE in my web page.
I tried many ways but always get null for code below:

(String)js.executeScript("tinyMCE.activeEditor.getBody().isContentEditable");
Sers
  • 12,047
  • 2
  • 12
  • 31
rubizky
  • 11
  • 3
  • What do you get executing in browser console? – Sers Feb 24 '19 at 10:23
  • In the eclipse console, i'm getting this. Running JavaScript 'tinymce.activeEditor.getBody().isContentEditable' with parameters '[]' – rubizky Feb 24 '19 at 10:39
  • in the browser console I'm getting correct value as false. Because it is in readonly state. – rubizky Feb 24 '19 at 10:46
  • if editor is inside iframe element switch to it. [How to switch to iframe](https://stackoverflow.com/questions/9942928/how-to-handle-iframe-in-selenium-webdriver-using-java) – Sers Feb 24 '19 at 10:59
  • unfortunately there is no iframe. – rubizky Feb 24 '19 at 11:16

1 Answers1

0

You need to add return to the front of your JS script, e.g.

(String)js.executeScript("return tinyMCE.activeEditor.getBody().isContentEditable");
JeffC
  • 22,180
  • 5
  • 32
  • 55