I am trying to scrape Google results when I search \"What is 2+2\", but the following code is returning \'NoneType\' object has no attribute \'text\'.
When you run the code, you might encounter an AttributeError:
shell: AttributeError: 'NoneType' object has no attribute 'text'
If that’s the case, then take a step back and inspect your previous results. Were there any items with a value of None? You might have noticed that the structure of the page is not entirely uniform. There could be an advertisement in there that displays in a different way than the normal job postings, which may return different results
Reference:https://realpython.com/beautiful-soup-web-scraper-python/#extract-text-from-html-elements.