Reputation: 85
I am trying to write a test automation code and having a hard time finding an element using Xpath in the below structure.
<div id="270590-bar" class="chart-row clearfix" style="display: block;">
<div class="bar-col float">
<div class="bar-wrapper">
<div class="topic-name-wrapper" style="background-color: transparent;">Business</div>
<div class="bar" style="width:170px"></div>
</div>
<div style="float:left;position:relative; ">
<div class="level-dd-fake">Intermediate</div>
<select id="270590-level" class="level-dropdown level-select">
</div>
<div id="270590-un" class="topic unsubscribe" style="float:left; margin: 0px 0px 0px 1px !important;"></div>
</div>
There are several data rows which will use the same set of lines as above for each row.
When I give the value inside class="topic-name-wrapper"
eg:- Business
I want to select the DropDown
element at class="level-dropdown level-select"
Hope the question is clear and any help on this is really appreciated.
Upvotes: 0
Views: 453
Reputation: 1988
As far as I understand you need something like that:
//div[*[.='Business']]/following-sibling::div/select
Upvotes: 2