Micro Focus QTP (UFT) Forums

Full Version: Dynamic rich text editor, how to DP?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi all, please help me. I have a web page containing a dynamic rich text editor, loaded by javascript each time called, and I don't know how to set data for it. When I try record, QTP doesn't recognize it.
I've attached the html file, please have a look and help me. Thanks a lot indeed.
Try using getelementsbytagname() and getelementsbyid() function......u will find information on how to use them on MSDN......just type those function names in the search ................
Hi,
Thanks Gammaflare for your answer. I found yahoo compose mail page is like ly with the site I'm am trouble in. And my DP is:
----------------------------------------------------
Code:
Dim all_InputElements
Set all_InputElements=Browser("title:=Compose(.*)").object.Document.getelementsbytagname("TEXTAREA")
Dim single_Element

For each single_Element in all_InputElements
If single_element.name="Content" Then
Print single_element.outerhtml
End If
Next
----------------------------------------------------
And I found the answer is
Code:
<TEXTAREA class=composecolumn id=composeArea style="PADDING-RIGHT: 0px; DISPLAY: none; PADDING-LEFT: 5px; PADDING-BOTTOM: 0px; PADDING-TOP: 5px" tabIndex=6 name=Content></TEXTAREA>
However, I still can't set data for the content of the mail with this DP(the script well done but in the receipt mail, I can't see the content):
----------------------------------------------------
Code:
With Browser("title:=Compose(.*)").Page("title:=Compose(.*)")
    .WebEdit("html tag:=TEXTAREA","index:=0").Set "haiintel@yahoo.com"
    .WebEdit("type:=text", "name:=Subj").Set "test mail ne"
    .WebElement("name:=Content").Object.innerHTML="Testing"
    '.WebElement("html tag:=TEXTAREA","index:=3").Object.innerHTML="Testing"
    .WebButton("type:=submit", "name:=Send", "index:=1").Click
End with

Browser("micclass:=Browser").Page("micclass:=Page").Sync
---------------------------------------------------------
What am I wrong? Pls help me.
Hi all,
I have found the way to deal:
Code:
Dim all_InputElements
Set all_InputElements=Browser("title:=Compose(.*)").object.Document.getelementsbytagname("IFRAME")
Dim single_Element

For each single_Element in all_InputElements
If single_element.id="compose_editorArea" Then
Print single_element.outerhtml
    single_element.contentWindow.document.body.innerHTML = "tinh ne"
    Print content
End If
Next

Thanks everybody a lot for helping me.
Very Simple Method Use below format for all unrecognized Text editors:

Code:
Browser("something").Page("something").Frame("Frame").WebElement("micclass:=WebElement","html tag:=BODY").object.innertext = "I have found a way to deal with Text editors"