Reputation: 3
I am using Selenium IDE and need to store a span id value:
<span id="ustData"
data-itemId="2130078"></span> <div class="clear"></div>
</div>
I want to store the value "2130078". This value changes for each page but is not visible. I have looked far and wide for a solution.
Currently using xpath location:
StoreAtribute
//data-itemId[@span='ustData']
From documentation I have read this seems correct?
When I run the test I get: [error] Element //data-itemId[@span='ustData'] not found
Any help would very much appreciated.
Upvotes: 0
Views: 2689
Reputation: 11321
Your XPath should be:
//span[@id='ustData']
to match your span tag with an id attribute of 'ustData'
Then if you want to get the data-itemId
attribute you can do:
//span[@id='ustData']/@data-itemId
Upvotes: 1