Reputation: 157
There is Dropdown list with the following code. How to write XPath for this element?
<div class="dropdown ">
<button class="btn btn-default dropdown-toggle btn-block" type="button">
<!-- react-text: 346 -->
Select door
<!-- /react-text -->
<span class="glyphicon glyphicon-chevron-down"/>
</button>
<div class="dropdown-menu">
</div>
Upvotes: 2
Views: 4086
Reputation: 111521
This XPath,
//button[normalize-space() = 'Select door']
will select the shown button
element based on its Select door label.
This XPath,
//button[normalize-space()='Select door']/following-sibling::div[@class='dropdown-menu'][1]
will select the immediately following dropdown-menu
div
.
Upvotes: 8