Reputation: 263
The following xpath that I have returns 3 table items and I would like to access each value individually.
//div[@class='transform section']//div[@class='inner-border-section-gray-container']//div[@class='related-tables-section']//div[@class='inner-section']//span[@class='related-tables']
How can I access "customer", "lineitem" and "orders" individually using xpath?
Can someone please help with the above?
Upvotes: 0
Views: 41
Reputation: 89285
You can try using /text()
to get text nodes that is direct child of the <span>
:
//span[@class='related-tables']/text()
you may want to add condition to filter out empty text nodes :
//span[@class='related-tables']/text()[normalize-space()]
Upvotes: 1
Reputation: 175
Is it possible for you to supply them individually with a surrounding element? Then you could use the data attribute, if using Razer syntax you must say data_myVariable="something" otherwise replace the "_" with a "-" and you can then access the data attribute using data-myVariable.
Upvotes: 0