A gentleman recently posted to an old post of mine on Weblist. He asked:
How do I add items to weblist? My weblist is empty and I want to add few items to it.
Thanks,
Durgesh
First off, it seems odd to me that you'd need/want to add to items in a weblist via QTP, but hey, it's not my test, right? :-) Basically, the best way would be to use the HTML DOM to do it. Here's a a bit code to do this might look like:
Dim objDoc
Dim objElement
Dim newNode
Set objDoc = Browser("myBrowser").Page("myPage").Object
Set objElement = objDoc.GetElementByID("myWebList")
Set newNode = objDoc.createElement("option")
newNode.Text = "Test"
objElement.add newNode
Set newNode = Nothing
Set objElement = Nothing
Set objDoc = Nothing
Enjoy!
posted @ Wednesday, April 30, 2008 5:53 PM