4

This previously asked question's answer was to use a plugin but that plugin is no longer maintained or even available. Without using a plugin, how do you verify text present on an XML page?

For example, how do you verify that the URL for a test page is present on the sitemap.xml for your site?

Community
  • 1
  • 1
Joe Golton
  • 612
  • 6
  • 12

1 Answers1

1

Use assertElementPresent in conjunction with xPath:

store  "http://yourwebsite.com"  baseURL
store  your/test/page/  test_page_URL
open  ${baseURL}/sitemap.xml
assertElementPresent  //*[contains(text(),'${baseURL}/${test_page_URL}')]

Selenium IDE is not designed for XML pages so it took much experimentation before I was able to figure how to get xPath to work to find the text.

That last line basically says:

Assert existence of the string '${baseURL}/${test_page_URL}' anywhere on the page (with the values for variables baseURL and test_page_URL plugged in).

Joe Golton
  • 612
  • 6
  • 12