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

How do you select some text in the editor?

2 Answers 58 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
woaksie
Top achievements
Rank 2
woaksie asked on 20 Oct 2009, 06:17 PM
I have a Telerik editor on a page with some text in it. I have a test that needs to be able to select a particular word but haven't found a way to to that with the Telerik.WebAii.Controls.

Anyone know how to do this?

2 Answers, 1 is accepted

Sort by
0
Missing User
answered on 20 Oct 2009, 08:35 PM
Hi John,

So based on this RadEditor demo page, you can get the string from the body tag like this:

Manager.LaunchNewBrowser(BrowserType.InternetExplorer);
Browser b = ActiveBrowser.Frames.ById("RadEditor1_contentIframe");
HtmlControl c = b.Find.ByTagIndex<HtmlControl>("body",0);
String s = c.BaseElement.GetPreservedInnerText(true);

and parse out the word you wanted.

But were you looking to highlight a particular word? Here you would need write a Desktop.Mouse.DragDrop operation and calculate the coordinates to start and stop on screen to highlight the word. 

Highlighting this way may seem somewhat tedious to write, but please keep in mind that WebUI Test Studio would be able to do this and more for you automatically.

Greetings,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
woaksie
Top achievements
Rank 2
answered on 20 Oct 2009, 11:46 PM
Ah, I was afraid of that. I can now see the benefit of Test Studio.
Tags
General Discussions
Asked by
woaksie
Top achievements
Rank 2
Answers by
Missing User
woaksie
Top achievements
Rank 2
Share this question
or