Python Forum
AttributeError: ResultSet object has no attribute 'get_text'
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AttributeError: ResultSet object has no attribute 'get_text'
#1
On the job web page I am scraping, some of the jobs have a Job Requirements. I am trying to get the list of requirements and having difficulty.

Below is the html code I need to get the requirement info:

`
<div class="jobCardReqContainer">
<div class="jobCardReqHeader">Requirements</div>
<div class="jobCardReqList"><div class="jobCardReqItem">Windows: 2 years</div>
<div class="jobCardReqItem">Python Software Development: 3 years</div>
<div class="jobCardReqItem">Cloud Technologies: 3 years</div>
</div>
`

Below is my code that is not working:

`
job_req = jobs[rcount].find_all("div", "jobCardReqItem").get_text().strip()
print(job_req)
`
Reply
#2
Quick test so it work,check turn of JavaScript in Browser then reload page and see if still can see Remote.
If not may need to use Selenium so can get value generated bye JavaScript.
>>> from bs4 import BeautifulSoup
>>> 
>>> html = '<span class="remote">Remote</span>'
>>> soup = BeautifulSoup(html, 'lxml')
>>> s_tag = soup.find('span', class_="remote")
>>> s_tag
<span class="remote">Remote</span>
>>> s_tag.text
'Remote'

>>> # Using CSS selector
>>> soup.select_one('.remote').text
'Remote'
KatMac likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  AttributeError: 'NoneType' object in a parser - stops it apollo 4 912 May-28-2021, 02:13 PM
Last Post: Daring_T
  Python and MYSQL Resultset vj78 2 689 Apr-02-2021, 12:41 AM
Last Post: vj78
  Python 3.9 : BeautifulSoup: 'NoneType' object has no attribute 'text' fudgemasterultra 1 2,613 Mar-03-2021, 09:40 AM
Last Post: Larz60+
  'NavigableString' object has no attribute 'h2' RandomCoder 5 1,937 May-20-2020, 09:01 AM
Last Post: Larz60+
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 4 4,946 Nov-11-2019, 05:15 PM
Last Post: nazmulfinance
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 0 1,273 Nov-10-2019, 09:13 PM
Last Post: nazmulfinance
  form.populate_obj problem "object has no attribute translate" pascale 0 1,895 Jun-12-2019, 07:30 PM
Last Post: pascale
  Error object has no attribute text hcyeap 3 10,394 May-21-2019, 07:12 AM
Last Post: buran
  AttributeError: 'Response' object has no attribute 'replace' Truman 12 14,359 Mar-20-2019, 12:59 AM
Last Post: ichabod801
  AttributeError: 'dict' object has no attribute 'is_active' (PyMongo And Flask) usman 0 2,931 Nov-20-2018, 09:50 PM
Last Post: usman

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020