This is simple XML data validation from any file. Please find my Inline
comments in the script.
Hope this would be sufficient.. :)
nJoy..!!
*'Creating variable to store InnerHTML*
var_Object = btnEle.InnerHTML
* 'CreatingXML DOM object to handle various DOM operations*
Set xmlDoc = CreateObject("MSXML.DOMDocument")
*
'Alternate way of Creating XML DOM object to handle various DOM
operations*
*Set xmlDoc = CreateObject("Microsoft.XMLDOM")*
*'Storing the InnerHTML data in XML format as <Root> InnerHTMLText </Root>
in b/w replacing the text "TSNS:" by blank.** This would create data XML
file format which can loaded as XML file*
var_Object = "<Root>" & replace(var_Object,"TSNS:","") & "</Root>"
*'Loading the XML Data prepared above*
xmlDoc.LoadXML(Trim(var_Object))
*'Fetching all the Nodes upto the path "Root/Tab**" into the nodelist.
Nodelist is nothing but a temporary collection type of XML used for
processing the data*.
Set nodelist = xmlDoc.SelectNodes("Root/Tab")
*'Looping thr' the nodelist to match it's data/text with the input text you
will be giving*
For i = 0 to nodelist.Length - 1
*'Checkpoint to validate the input text with nodelist item text*
If Trim(strInput) = nodelist.item(i).text Then
'*'Marking selecting Index equal to the node-value at which the
match found*
selInd = i
*'Exiting loop if match found*
Exit For
End If
Next
*'marking selected index equal to the node at which the match found*
btnEle.SelectedIndex = selInd
*'Forcing QTP to click on the element even if it fails to recognizes the
object*
btnEle.fireevent "onclick"
'btnEle.Click
Regards
Shalabh Dixit
On Tue, Jul 19, 2011 at 7:30 AM, Roman Zilber <[email protected]> wrote:
> Google: DOM
> http://www.w3schools.com/dom/default.asp
> http://msdn.microsoft.com/en-us/library/aa468547.aspx
>
> Google: COM Object vbscript
>
> On Mon, Jul 18, 2011 at 9:36 PM, Thejaswi V <[email protected]> wrote:
>
>> Hi,
>>
>> Please explain me following script. Please let me know how to write these
>> types of scripts (any help files).
>>
>> var_Object = btnEle.InnerHTML
>> Set xmlDoc = CreateObject("MSXML.DOMDocument")
>> var_Object = "<Root>" & replace(var_Object,"TSNS:","") &
>> "</Root>"
>> xmlDoc.LoadXML(Trim(var_Object))
>> Set nodelist = xmlDoc.SelectNodes("Root/Tab")
>> For i = 0 to nodelist.Length - 1
>> If Trim(strInput) = nodelist.item(i).text Then
>> selInd = i
>> Exit For
>> End If
>> Next
>> btnEle.SelectedIndex = selInd
>> btnEle.fireevent "onclick"
>> 'btnEle.Click
>>
>> Thanks,
>> Th
>>
>> --
>> You received this message because you are subscribed to the Google
>> "QTP - HP Quick Test Professional - Automated Software Testing"
>> group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]
>> For more options, visit this group at
>> http://groups.google.com/group/MercuryQTP?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> "QTP - HP Quick Test Professional - Automated Software Testing"
> group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/MercuryQTP?hl=en
>
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en