Html code of an svg element :
<image xlink:href="start.gif" style="pointer-events:none" x="165" y="175" width="100" height="100" stroke-width="1" transform=" scale(1 1) translate(0 0)"/>
Just as a POC,
$('image').attr('xlink:href');
does return the attribute value as start.gif
.
Now I need the attribute values of all the image elements, so I wrote a function
function script()
{
var result = new Array();
var elements = selenium.browserbot.getCurrentWindow().jQuery('image');
for(var i = 0 ; i < elements.length ; i++)
{
result[i] = $(this).attr('xlink:href');
}
return result;
}
script();
but this returns undefined
Why is that happening?
And yeah, I did try using jQuery's $.each(function(key, value)), but selenium throws "Error: Threw an exception : c.call is not a function". Didn't understand what c and call refers to, so thought to use js for loop.