Answer the question
In order to leave comments, you need to log in
Python. selenium. Extra information is being parsed, how to correct the path?
The html code for the page is as follows:
<div class="product_item__description ">
<div>
9 000
<span class="rub">
<!--noindex-->
<b>₽</b>
<!--/noindex-->
<i class="rub__old">руб.</i></span>
</div>
<div class="product_item__old-price">
10 000 <span class="rub">
<!--noindex--><b>₽</b>
<!--/noindex-->
<i class="rub__old">руб.</i></span>
</div>
</div>
prices= driver.find_elements_by_css_selector("div.product_item__description > div")
Answer the question
In order to leave comments, you need to log in
the second one has a special class ))
product_item__old-price
choose div without it and the whole
second option - just take the first div, but it's crooked if it turns out to be empty
Refer to the first div element:
prices= driver.find_elements_by_css_selector("div.product_item__description > div")
print(prices[0].text)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question