1

I have a link, clicking on which will open a new browser with only XML content in it. I need to verify certain tags in this XML.

Please let me know how do I do it.

Tried getBodyText, getHtmlSource and getText - Nothing helps...!

Thanks, Mike

3
  • By opening you mean new browser window? If yes, you should change current window to new one. Commented Dec 24, 2012 at 13:52
  • @p0deje: Yes a new browser window... I do switch to the new window but getting the text(in plain format or XML format) is not possible... Commented Dec 26, 2012 at 7:33
  • It should be noted that you don't need to use a browser object to retreive XML from a webservice: you can do it with a simple HTTP post, such as with Apache HTTP utils. Commented Jan 8, 2013 at 16:28

3 Answers 3

1

First download the xml and use a xml parser to parse the xml as per your need.

I am using jdom(http://www.jdom.org/) for parsing my xml files.

To understand how IE renders the XML, please go through: -

http://msdn.microsoft.com/en-us/library/windows/desktop/ms757841(v=vs.85).aspx

Let me know if you need any further help on this.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks PD Mohanty. I am able to do this now.
1

Try to get the xpaths of the tags you want to verify and then use getText.

Comments

1

You can get the source of page with getPageSource(). Then you can parse source with any XML processor (not sure which one is the best in Java) and perform assertions for processed XML.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.