take top element Selenium, python, scraping

Asked

Viewed 18 times

-1

<div class="cell-list-content-icon">
<span><i class="fa fa-briefcase"></i>EMPRESA XXXXXXXX</span>
<span><i class="fas fa-map-marker-alt"></i>Remoto</span>
<span><i class="fa fa-building"></i>Grande empresa</span>
<span><i class="far fa-money-bill-alt"></i>R$7.000</span>
<span><i class="far fa-chart-bar"></i>Pleno</span><span>
<i class="far fa-file-alt"></i>CLT</span>
<span><i class="fas fa-plane"></i>Aceita candidatos de fora</span></div>

How do I get the amount "R$7,000

<span><i class="far fa-money-bill-alt"></i>R$7.000</span>

He’s inside the SPAN keys I can locate the id = "far fa-money-Bill-alt"

But Value is on a top or top mark, span mark

1 answer

1

from bs4 import BeautifulSoup as bs
html = """
<div class="cell-list-content-icon">
<span><i class="fa fa-briefcase"></i>EMPRESA XXXXXXXX</span>
<span><i class="fas fa-map-marker-alt"></i>Remoto</span>
<span><i class="fa fa-building"></i>Grande empresa</span>
<span><i class="far fa-money-bill-alt"></i>R$7.000</span>
<span><i class="far fa-chart-bar"></i>Pleno</span><span>
<i class="far fa-file-alt"></i>CLT</span>
<span><i class="fas fa-plane"></i>Aceita candidatos de fora</span></div>
"""
belo = bs(html, 'html5lib')
spans = belo.find_all('span')
spans[3].text

Edit:

With Selenium after the created driver uses the method: .find_element_by_xpath('//div/span[3]/text()')

Browser other questions tagged

You are not signed in. Login or sign up in order to post.