Skip to content

Selenium WebDriver Tips for ‘tinymce’ Text Editor

I have wordpress installed on my localhost server. I was automating some functionality using Selenium Webdriver.

Problem

The challenging thing to resolve was ‘tinymce’ (which is a text editor in wordpress) location in webdriver. Because I was able to use xpath expression for RC and IDE but the same code failed in WebDriver. I must have spent almost few hours to get the code working.

Solution

Thanks to ‘Google’ search engine and various channels available like Stackoverflow in which users handle various problems and various plug-ins like Firebug.

Web Driver is unable to recognize ‘tinymce’, so you have to switch to the frame in which your ‘tinymce’ text editor is available. Web Driver then recognizes and performs the instructions. But you can’t access other ‘ids’ because you are in the frame so you need to switch back so that Web Driver will recognize rest of the elements from the page.

 Here is the snippet of the code for WebDriver:

driver.switchTo().frame(“content_ifr”);
driver.findElement(By.id(“tinymce”)).sendKeys(“hello”);
driver.switchTo().defaultContent();

Follow

Savita Munde

Tester at Mindhunters
She is a Tester by profession. Works on various freelance QA projects. And she is twin's mom.
Follow

Latest posts by Savita Munde (see all)

2 thoughts on “Selenium WebDriver Tips for ‘tinymce’ Text Editor

  1. Dwarika says:

    Same kind of problem I have faced while automating my compose mail in Gmail, In IDE and RC I was able to write mail but with Webdriver I was unable.

    Now I can try you method to resolve my problem.

    Thank you for posting this here.
    Great regards to you for posting solution to my problem.

    Reply
  2. jai says:

    Why the step after driver.switchTo().defaultContent(); is not executing. Here we go with code

    driver.switchTo().frame(“content_ifr”);
    driver.findElement(By.id(“tinymce”)).sendKeys(“Hello”);
    driver.switchTo().defaultContent();
    driver.findElement(By.xpath(“.//*[@id=’publish’]”)).click();

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *