Reputation: 155
I need to get the text from,
<option value="......" >.......
, But except first option tag.
My code is:
"xPath":"descendant::div[contains(@class,'produit__select')]/descendant::select[@name='select0']/descendant::option[@disabled='disabled']/value"
I can't get the results. Can some one help me this?
<div class="produit__select">
<label for="select0">Parfum</label>
<select name="select0" id="select0">
<option disabled="disabled">Faites un choix</option>
<option value="835">Pommes de Nouvelle Aquitaine</option>
<option value="842">Pommes Nectarines Bananes</option>
<option value="838">Pommes Pruneaux</option>
<option value="839" selected="selected">Pommes Fraises</option>
<option value="841">Pommes Cassis</option>
<option value="840">Pommes Bananes Kiwi</option>
<option value="836">Pommes Poires</option>
<option value="837">Pommes Coings</option>
</select>
</div>
Upvotes: 0
Views: 327
Reputation: 33384
This is another option to skip disabled one.
//div[@class='produit__select']/select[@name='select0']/option[not(contains(@disabled,'disabled'))]/text()
DEMO:
Upvotes: 1
Reputation: 242208
You can use //
instead of descendant::
. Also, there's no element named value
. If you are interested in the text, use the text()
function, if you want to skip the first child, make sure the position()
of the child is greater than 1.
//div[contains(@class,'produit__select')]
/select[@name='select0']
/option[position()>1]/text()
Upvotes: 2