Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selenium related queries
#2
Quote:
dates = data.find_elements_by_id("completion_dt")
for date in dates:
    dt_obj = datetime.datetime.strptime(date, '%M/%d/%Y')

.find_elements_by_id() returns a list of elements, not a list of strings. The datetime module doesn't know how to get a date out of whatever selenium is giving you, so you need to get the date out of the element first. Which is also what your error is telling you.
Reply


Messages In This Thread
Selenium related queries - by Prince_Bhatia - Dec-28-2017, 08:14 AM
RE: Selenium related queries - by nilamo - Dec-28-2017, 04:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,661 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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