I am trying to web scrape using selenium and beautiful soupe but i cannot get selenium to find the element I need and return the text.
here is the html:
<span class="t-14 t-normal">
<span aria-hidden="true"><!---->Crédit Agricole CIB · Full-time<!----></span><span class="visually-hidden"><!---->Crédit Agricole CIB · Full-time<!----></span>
</span>
Do you know how to get the text 'Crédit Agricole CIB Full-time' from this html?
I am trying to do something like this:
src = driver.page_source
soup = BeautifulSoup(src, 'lxml') # Now using beautiful soup
intro = soup.find('div', {'class': 'pv-text-details__left-panel'})
text_loc = intro.find( ???? ) # Extracting the text
text = text_loc.get_text().strip() # Removing extra blank space
I do not know what to put in the ????
I can't confirm without knowing exactly what the full HTML looks like - there might be other very similarly nested elements before the snippet shared in the question, but if there aren't then you can use
soup.select_onewith the css selectors used below:should give the output
EDIT:
I think the
ember..section ids are dynamically generated and might be different every time. A more reliable selector for the jobs listed in the experience section might be(It's going for the list next to the [empty]
div id="experience"anchor)You can even choose a specific experience from the list by changing the end to
li:nth-child(2)for the second experience,li:last-childfor the last experience,li:nth-last-child(2)for the second-to-last experience, etc...You could directly add on to the selector to get the first company:
and that should print
Crédit Agricole CIB · Full-timeYou could also use
expSelto get all the listed experience:output: