0
votes

I am testing websites using selenium IDE and I have an XML file with articles for one sports website.

URLs to articles are stored in the XML file like this:

<urlset>
    <url>
        <loc>
            http://www.someurl.com
        </loc>
    </url>
</urlset>

Is there any way to store the text of /urlset/url/loc in a variable in Selenium IDE?

2
saucelabs.com/resources/… <- your answer is right here. - ddavison
yes, selenium IDE supports this kind of XML file, but only with the same scheme - it only uses testdata and test emelents, how to store data that is in a different location in XML? - Jan Galik

2 Answers

0
votes

SeLite is a plugin for data driven testing, specifically the SelBlocks part. I've only used it with a json input myself but it does support XML as well

0
votes

It seems you try to load and evaluate a sitemap.xml wit seleniumIDE. The way that works for me was to use javascript in combination with assertEval like this:

1) 
open
URL_TO_YOUR_SITEMAP.XML

2)
assertEval
javascript{window.opener.content.document.getElementsByTagName('urlset').length}
1

3) // what you want
store
javascript{window.opener.content.document.getElementsByTagName('urlset')[0].children[0].children[0].textContent}
firstUrl

4) // optional: a direct assert without using a variable
assertVal
javascript{window.opener.content.document.getElementsByTagName('urlset')[0].children[0].children[0].textContent === 'http://www.someurl.com'}
true

The actual trick is to use

window.opener.content.document

to access the opened document. If you use just "document", the XULDomument of SeleniumIDE will be accessed