Skip to main content

Selenium and ExtJS HtmlEditor

I had to add a selenium test for a page with ExtJS HtmlEditor and selenium wont recognize it, even tests recorded with Selenium IDE wont recognize it. The reason is that HtmlEditor uses a hidden textarea and a DIV on top of it to trap keystrokes. I tried using lots of ways to set text into it but it would complain about component not visible  and other stuff. Finally the only way I could do is to execute Javascript from webdriver. Here is the code that I used to set the text.

                String notes = "This is a test note from selenium";
		JavascriptExecutor js = (JavascriptExecutor) driver;
		js.executeScript("Ext.getCmp('notes').setValue('"
				+ notes + "')");
 
 

Comments