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

Telerik doesn't support "contenteditable" in Div (HTML5)

3 Answers 133 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tuan
Top achievements
Rank 1
Tuan asked on 14 May 2012, 09:30 AM
Hi Telerik,

I'm using Telerik to make some Demo to make sure that Telerik is able to automation HTML5. So I go to http://www.apple.com/html5/showcase/typography/ 
That is apple HTML5 show case. There's a field Div that can be edit but I can't find any method to input text into Div tag.
Could you support that? How many percent of HTML5 features that Telerik can cover? (I need that to decide using Telerik or not)

Thank you

3 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 14 May 2012, 05:33 PM
Hello Tuan,

You won't be able to set text directly on the <div> element. Instead, you'll have to click it to set focus and invoke keyboard typing:

HtmlDiv d = Find.ById<HtmlDiv>("typography-text");
d.MouseClick();
 
Manager.Desktop.KeyBoard.KeyDown(System.Windows.Forms.Keys.LControlKey);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.A);
Manager.Desktop.KeyBoard.KeyUp(System.Windows.Forms.Keys.LControlKey);
Manager.Desktop.KeyBoard.TypeText("TELERIK", 20);

Here is a list of the supported HTML5 controls.

Kind regards,
Anthony
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
0
Tuan
Top achievements
Rank 1
answered on 15 May 2012, 03:35 AM
Hi Anthony,

I'll try as what you suggest, but why don't you implement "type" method for other objects (like HtmlControls or HtmlDiv) that would be more awesome :) 

Regards

Tuan
0
Cody
Telerik team
answered on 15 May 2012, 10:08 PM
Hello,

The attribute contenteditable="true" instructs the browser to turn the element (e.g. <div>) into something similar to a rich text box editor. Presently many of our Htmlxxxx wrappers do have a .text property that can be used to read/set the text contents. These are only for simple text fields which cannot have rich content.

A <div> with contenteditable="true" can have all kinds of content such as lists, dropdowns, etc.  such as here. A simple .text property does not work in this case. Only simulated typing will allow the browser to handle the keystrokes and be the rich text editor it wants to be. This is why the Manager.Desktop.KeyBoard methods are the best approach for this scenario.

All the best,
Cody
the Telerik team
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
Tags
General Discussions
Asked by
Tuan
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Tuan
Top achievements
Rank 1
Cody
Telerik team
Share this question
or