Manual and Automated Testing
›
General Discussion
Search
everywhere
only in this topic
Advanced Search
Conditional XPATH in Selenium WebDriver ?
Classic
List
Threaded
♦
♦
Locked
3 messages
Robin Tyagi
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Conditional XPATH in Selenium WebDriver ?
Hi Folks,
Can someone suggest me how shall we write XPATH for below Tags.
Lets consider, there is 1 Div and 3 Span tag. Here we have to write XPATH for only 1 Span which will contain
. Position of
is getting changed dynamically.
could be found with in 1, 2 OR 3 Span Tag. So wherever it occurs, write XPATH only for that valid span having
<Div class='country'>
US
Germany
India
Note :
could be at any position, at 1st span, 2nd or 3rd
</Div>
Thanks,
Robin
Robin Tyagi
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Conditional XPATH in Selenium WebDriver ?
I am trying to give more explanation. please have a look. will //div/span/a work ? or what should be the right xpath
1. <div>
.......................
.......................
..........
Here
occurs at 3rd span
</div>
2. <div>
..........
.......................
......................
Here
occurs at 1st span
</div>
3. <div>
......................
..........
......................
Here
occurs at 2nd span
</div>
Note -> position of
is dynamic, it may occur in any of the three span tag
softwaretestingforum
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Conditional XPATH in Selenium WebDriver ?
Administrator
In reply to
this post
by Robin Tyagi
You mentioned in first post -
which will contain .
but I don't see . in html example. Could you post html of example after hiding any sensitive information?
~ seleniumtests.com
Free forum by Nabble
Edit this page