Descriptive Programming Problem
Question ID: 106918
0
0

I have a web page with a list of entries, and each entry is a div with class ‘feedEntryContent’ and includes an unordered list. I am trying to grab the information in the second list item in each and use these as query parameters in the application. The page that I am trying to parse is an RSS feed which is in an xml format with html inside. Using regular xpath did not work, so I tried loading the XMLDOM, and I was successful at least getting the number of items in the list, but I could not get the text inside. The xml had a ‘Content’ node, but getting the nodeValue yielded nothing. The steps I used were:
Const XMLDataFile = "http:///alertstore/nrl-safe?"
Set xmlDoc = CreateObject("Microsoft.XML.DOM")
xmlDoc.Async = False
xmlDoc.Load(XMLDataFile)
Set nodes = xmlDoc.SelectNodes("//content")
msgbox "Total nodes: "&nodes(0).NodeValue

I had tried to get a collection of these lists though Description.Create(), but that also did not work. I tried

Set oDesc = Description.Create()
oDesc("xpath:=//div[contains(@class,’feedEntryContent’)]/ul/li[2]")
Set colObject = Browser("title:=nrl-safe").Page("title:=nrl-safe").ChildObjects(oDesc)
msgbox "The number of entries on this page is "&colObject.count

but the msgbox always gives me 0. I discovered that even when I locate the object using Firepath and use the exact xpath, it did not work here. I have attached an example that I had to type from scratch since I could not copy it from a classified system, but it gives the basic structure of the xml page.

Marked as spam
Posted by (Questions: 44, Answers: 0)
Asked on June 24, 2016 6:59 pm
154 views
Answers (1)
0
Private answer

Have you tried to copy the data out of the XML into a HTML file and it would not render in the browser. I recommend before writting the HTML file you can do a REPLACE to replace the & l t ; with '<' character. Below is example from QTP/UFT Help... Replace(expression, find, replacewith[, start[, count[, compare]]]) Returns a string in which a specified substring has been replaced with another substring a specified number of times. Arguments expression

Marked as spam
Posted by (Questions: 2, Answers: 98)
Answered on June 24, 2016 6:59 pm
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top