Hi there,
My company is utilizing the full CK Editor, and I am attempting to make automation tests for a page that has implemented the editor.
I have difficulty finding the CKEditor on this page using Coded UI scripts (C# in Visual Studios 2012).
The object can be targeted using the Coded UI Test Builder, and the attributes of the object are fairly logical, but the text field itself appears to be considered an HtmlDocument, and text entered by the user is contained in the InnerText attribute.
The issue is that the Coded UI believes an HtmlDocument is read-only. If the Coded UI can even find the WYSIWYG at all, it determines that the appropriate attributes cannot be altered.
Here are two methods that I have tried: (I've changed variable names to protect sensative information)
//First line calls a method that finds CK Editors on any page and stores it in a collection.
UITestControlCollection ckEditorCollection = getCkRichTextEditor(htmlDoc);
//Assume assertions have been made, and only a single UITestControl exists in the collection.
//Cast object as an HtmlTextArea so that
HtmlTextArea textArea = (HtmlTextArea) ckEditorCollection[0];
//Take HtmlTextArea and add test.
textArea.Text = TestContext.DataRow["Placeholder"].ToString();
//Result: Error. cannot cast HtmlTextDocument as HtmlTextArea. *The issue appears to be that this CKEditor is considered a Document rather than a modifiable object.
//Here is the second, much simpler method, and it does not work either. Take property and change it.
ckEditorCollection[0].InnerText = "TestingThis";
//Error: cannot change a read-only value.
Any and all help is greatly appreciated.