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: 'ellipsis' object has no attribute 'register_blueprint' Mechanicalpixelz 2 197 Dec-29-2021, 01:30 AM
Last Post: Mechanicalpixelz
  Parsing bs4 Resultset gw1500se 4 390 Nov-09-2021, 04:06 AM
Last Post: snippsat
  AttributeError: 'NoneType' object in a parser - stops it apollo 4 1,668 May-28-2021, 02:13 PM
Last Post: Daring_T
  Python and MYSQL Resultset vj78 2 1,034 Apr-02-2021, 12:41 AM
Last Post: vj78
  Python 3.9 : BeautifulSoup: 'NoneType' object has no attribute 'text' fudgemasterultra 1 4,206 Mar-03-2021, 09:40 AM
Last Post: Larz60+
  'NavigableString' object has no attribute 'h2' RandomCoder 5 2,397 May-20-2020, 09:01 AM
Last Post: Larz60+
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 4 5,966 Nov-11-2019, 05:15 PM
Last Post: nazmulfinance
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 0 1,564 Nov-10-2019, 09:13 PM
Last Post: nazmulfinance
  form.populate_obj problem "object has no attribute translate" pascale 0 2,253 Jun-12-2019, 07:30 PM
Last Post: pascale
  Error object has no attribute text hcyeap 3 11,152 May-21-2019, 07:12 AM
Last Post: buran

Forum Jump:

User Panel Messages

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