Micro Focus QTP (UFT) Forums
Dynamic rich text editor, how to DP? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Dynamic rich text editor, how to DP? (/Thread-Dynamic-rich-text-editor-how-to-DP)



Dynamic rich text editor, how to DP? - haiintel - 07-25-2008

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.


RE: Dynamic rich text editor, how to DP? - gammaflare - 07-27-2008

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 ................


RE: Dynamic rich text editor, how to DP? - haiintel - 07-29-2008

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.


RE: Dynamic rich text editor, how to DP? - haiintel - 07-30-2008

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.


RE: Dynamic rich text editor, how to DP? - cashgiga - 01-15-2009

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"