Skip to content
Advertisement

Web scraping Trulia with Pythons Selenium

I am trying to webscrape the trulia estimate for a given address. Although some addresses do not have a trulia estimate. So I want to first try to find the text ‘Trulia estimate’ and if it is found then I will try to find the value. At the moment I cannot figure out how to find the Trulia Estimate text which is shown here:

enter image description here

Here is the code I have so far:

JavaScript

Any suggestions are greatly appreciated.

Advertisement

Answer

Version using beautifulsoup:

JavaScript

Prints:

JavaScript

The CSS Selector h3:has(+div span:contains("Trulia Estimate")) finds <h3> that has tag <div> containing <span> with string “Trulia Estimate” as direct sibling.

Further reading:

CSS Selectors Reference

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement