Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic rich text editor, how to DP?
#1
Solved: 10 Years, 9 Months, 1 Week ago
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.


Attached Files
.txt   di hoi.txt (Size: 56.8 KB / Downloads: 102)
Reply
#2
Solved: 10 Years, 9 Months, 1 Week ago
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 ................
Reply
#3
Solved: 10 Years, 9 Months, 1 Week ago
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.
Reply
#4
Solved: 10 Years, 9 Months, 1 Week ago
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.
Reply
#5
Solved: 10 Years, 9 Months, 1 Week ago
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"
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic obj rep - get text in the class (html) marcio cravo moreira 0 2,049 05-26-2015, 06:58 PM
Last Post: marcio cravo moreira
  Does QTP supprt online diagram editor dhanya 0 1,427 05-29-2014, 02:55 PM
Last Post: dhanya
  Read text from text file and save it into a variable in qtp arpan 3 12,139 06-19-2013, 08:34 PM
Last Post: arpan
  Need to compare two text files - ignoring some text nelly27281 2 4,381 09-09-2012, 12:09 PM
Last Post: freeboynil
  Finding specific text in a text string janriis 3 5,190 10-08-2010, 04:00 PM
Last Post: KavitaPriyaCR

Forum Jump:


Users browsing this thread: 1 Guest(s)