user3371812
user3371812

Reputation: 3

Span id not found in Selenium IDE

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

Answers (1)

donfuxx
donfuxx

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

Related Questions