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
  How to fix "'dict_values' object has no attribute 'inject_wsgi'" in session_transacti devid 0 2,572 Aug-13-2023, 07:52 AM
Last Post: devid
  AttributeError: 'ellipsis' object has no attribute 'register_blueprint' Mechanicalpixelz 2 4,517 Dec-29-2021, 01:30 AM
Last Post: Mechanicalpixelz
  Parsing bs4 Resultset gw1500se 4 9,663 Nov-09-2021, 04:06 AM
Last Post: snippsat
  AttributeError: 'NoneType' object in a parser - stops it apollo 4 6,006 May-28-2021, 02:13 PM
Last Post: Daring_T
  Python and MYSQL Resultset vj78 2 3,499 Apr-02-2021, 12:41 AM
Last Post: vj78
  Python 3.9 : BeautifulSoup: 'NoneType' object has no attribute 'text' fudgemasterultra 1 11,840 Mar-03-2021, 09:40 AM
Last Post: Larz60+
  'NavigableString' object has no attribute 'h2' RandomCoder 5 8,661 May-20-2020, 09:01 AM
Last Post: Larz60+
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 4 13,564 Nov-11-2019, 05:15 PM
Last Post: nazmulfinance
  AttributeError: 'str' object has no attribute 'xpath' nazmulfinance 0 4,286 Nov-10-2019, 09:13 PM
Last Post: nazmulfinance
  form.populate_obj problem "object has no attribute translate" pascale 0 5,010 Jun-12-2019, 07:30 PM
Last Post: pascale

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020
This forum uses Lukasz Tkacz MyBB addons.
Forum use Krzysztof "Supryk" Supryczynski addons.