Forum Discussion

NYefimov's avatar
NYefimov
Occasional Contributor
16 years ago

Validate HTML content

Hello,

I need to validate that for instance the service AccountManagementService has the value Pass
in its row in the attached file DiagnosticPage.html.

Can you write something for this, please?

I got the contents of the web page in the file by doing this:

def address = DiagnosticPage;
def file = new FileOutputStream("C:\\DiagnosticPage.html")
//def file = new FileOutputStream("C:\\DiagnosticPage.xml")
def out = new BufferedOutputStream(file)
out << new URL(address).openStream()
out.close()

Another question:
can you do the validation on the fly?
(without writing contents in the file first)

2 Replies

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi!

    you can use the new HTTP Request TestStep to get the HTML page which will then be converted to XML for use with the standard XPath assertions for validating content.. does that meet your requirements?

    regards!

    /Ole
    eviware.com