This is a migrated thread and some comments may be shown as answers.

kendoeditor

2 Answers 88 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Pete
Top achievements
Rank 1
Pete asked on 07 Mar 2013, 10:56 PM
please provide some code samples for testing kendoeditor.

1.  set value of kendo editor
2.  click toolbar of editor

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 13 Mar 2013, 01:35 PM
Hi Pete,

The Kendo UI Editor is a mixture of many Kendo controls, which makes its automation a bit complicated. Also the text field of the Editor is inside of an IFrame, so you need to locate the IFrame first. Here's a sample code against this Kendo UI Editor demo side:
myManager.LaunchNewBrowser(BrowserType.InternetExplorer, true);
 
myManager.ActiveBrowser.NavigateTo("http://demos.kendoui.com/web/editor/all-tools.html", true);
myManager.ActiveBrowser.WaitUntilReady();          
 
//Find the iframe where the editor text field is located
FrameInfo frameInfo = new FrameInfo("", "", "javascript:\"\"", 1);
ArtOfTest.WebAii.Core.Browser frame = myManager.ActiveBrowser.Frames[frameInfo];
 
//Find the editor text field
var textField = frame.Find.AllByTagName("body").FirstOrDefault();
 
//If the text field is not empty, clear the field
myManager.ActiveBrowser.Actions.SetText(textField, "");
 
//Enter the text
textField.As<HtmlControl>().MouseClick();
myManager.Desktop.KeyBoard.TypeText("Kendo Editor testing", 50, 100);
 
//Find all dropdown menus in the Kendo editor
IList<KendoInput> editorDropdownMenus = ActiveBrowser.Find.AllByAttributes<KendoInput>("class=k-widget k-dropdown k-header");
 
//Select font
editorDropdownMenus[0].ToggleCombo();
myManager.ActiveBrowser.Find.ByExpression<HtmlListItem>("tagname=li","TextContent=Impact").MouseClick();
 
//Select size
editorDropdownMenus[1].ToggleCombo();
myManager.ActiveBrowser.Find.ByExpression<HtmlListItem>("tagname=li","TextContent=5 (18pt)").MouseClick();

See this video for a demonstration and let me know if you need further assistance on this.

Regards,
Plamen
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Srinivasan
Top achievements
Rank 1
answered on 16 Jun 2015, 01:38 PM
The above doesn't select the font in the dropdownlist.
Tags
General Discussions
Asked by
Pete
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Srinivasan
Top achievements
Rank 1
Share this question
or