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

Automation test using selenium Kendo Editor value cannot be set.

2 Answers 1202 Views
Editor
This is a migrated thread and some comments may be shown as answers.
PK1402
Top achievements
Rank 1
PK1402 asked on 21 Feb 2013, 12:35 AM
Hi,

I am using Selenium automation testing in one of my view with kendo ui editor.

I couldn't pass values to the editor control from my test. Please give information how to do this.

View
====
 @(Html.Kendo().EditorFor(m => Model.reportDetail.Content) 
                    .Name("Content")
                    .HtmlAttributes(new { style = "width: 810px;height:500px" })
                    .Tools(tools => tools
                        .Clear()
                        .Bold()
                        .Italic()
                        .Underline()
                        .Strikethrough()
                        .FontName()
                        .FontSize()
                        .FormatBlock()
                        .FontColor()
                        .BackColor()
                        .InsertOrderedList()
                        .InsertUnorderedList()
                        .CreateLink()
                        ))

Test
====

[TestMethod]
public void TestName()
{
// code goes here..
var kendoEditor = webDriver.FindElement(By.Name("Content"));
// assert code goes here..
}

I need to set value as "Test" in the editor.

I couldn't assign value as other controls
Ex:- @Html.DropDownListFor

var yearInputControl = new SelectElement(webDriver.FindElement(By.Name("dateComponent.Year")));
yearInputControl.SelectByValue("2013");

Thanks in advance,
PK

2 Answers, 1 is accepted

Sort by
0
Atanas Georgiev
Telerik team
answered on 22 Feb 2013, 10:01 AM

Hello Liju Kochappan,

In order to gain your trust in our product and prove that KendoUI is perfectly testable with automation tools, we did a little investigation and following are the results:
Expected solution of the issue would be to call Selenium “sendKeys” on the “body” tag of the editor (the one with parameter “contenteditable=true”). Unfortunately this will not work, because of existing bug in Selenium (filed here: http://code.google.com/p/selenium/issues/detail?id=2442).
You can use jQuery to change Editor’s value, as a work around for that issue:
“$('#editor’).data('kendoEditor').value('new value here')”,  where “editor” is the "id"  parameter of kendoEditor’s “textarea” tag (There are many sources on the internet describing how to use jQuery with Selenium, e.g. : http://stackoverflow.com/questions/3235013/how-to-use-jquery-in-selenium).
I hope this answer will be a solution in your particular test case. Telerik team also recommends you to check out Telerik TestStudio at http://www.telerik.com/automated-testing-tools/. It includes KendoUI translators and may be a perfect solution for your automation testing issues (Demo video at: http://www.telerik.com/support/videos/asp-net-mvc-videos/get-started-with-testing-your-kendo-ui-web-apps.aspx) .

All the best,
Atanas Georgiev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
leblanc
Top achievements
Rank 1
answered on 06 Nov 2013, 07:49 PM
I recently released: https://github.com/leblancmeneses/RobustHaven.IntegrationTests
specifically http://www.nuget.org/packages/RobustHaven.IntegrationTests.KendoExtensions/ 
take a look at the source code here:
https://github.com/leblancmeneses/RobustHaven.IntegrationTests/tree/master/KendoExtensions
Tags
Editor
Asked by
PK1402
Top achievements
Rank 1
Answers by
Atanas Georgiev
Telerik team
leblanc
Top achievements
Rank 1
Share this question
or