Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Help] Copy and Paste using scripts
#1
Not Solved
Hi,

Since two days I'm trying to do simple thing. But It does not look so simple with QTP. Namely I want to read an. xml file then store/copy text and paste it in a text fields in a browser. I couldn't find any help. Google says almost nothing about it.

First i download a file from Quality Center
'Where to save and resource name
Code:
saveTo = "C:\PROMPT\QTP"
resourceName = "SCQ_2nd_loop.xml"

Set qcConn = QCUtil.QCConnection
Set oResource = qcConn.QCResourceFactory
Set oFilter =  oResource.Filter

oFilter.Filter("RSC_FILE_NAME") = resourceName
Set oResourceList = oFilter.NewList
If oResourceList.Count = 1 Then
Set oFile = oResourceList.Item(1)
oFile.FileName = resourceName
oFile.DownloadResource saveTo, True
End If

Then update it
'Step 1 - open .xml file and save

Code:
Const XMLDataFile = "C:\PROMPT\QTP\SCQ_2nd_loop.xml"
Const XMLNewFile = "C:\PROMPT\QTP\SCQ_2nd_loop_update_01.xml"
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)

'Step 2 - Set fields value

Code:
Set node = xmlDoc.SelectSingleNode("/ProductMaintenance/ProductMaintenancePlan/ProductMaintenanceQuotation/ProductMaintenanceQuotationNumber")
node.Text = "QN10013A"

'Step 3 - Save results

xmlDoc.Save(XMLNewFile)

Then I read it and make a print log but I don't really know if this point is necessary.
Code:
Const XMLDataFile = "C:\PROMPT\QTP\SCQ_2nd_loop_update_01.xml"

Set xmlObj = XMLUtil.CreateXML()
xmlObj.LoadFile("C:\PROMPT\QTP\SCQ_2nd_loop_update_01.xml")
Print xmlObj.ToString()

I just need one more point to copy the .xml text and paste it.

Thx in advance for your help
Matt
Reply


Messages In This Thread
[Help] Copy and Paste using scripts - by mwietrzyk - 01-12-2012, 06:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  VB Script code to copy files to ALM server resources wittyminds 0 1,865 04-02-2019, 04:06 PM
Last Post: wittyminds

Forum Jump:


Users browsing this thread: 4 Guest(s)