Python Forum
Create Dictionary List (From a webpage dropdown) for Comparison to a CSV File
Thread Rating:
  • 1 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create Dictionary List (From a webpage dropdown) for Comparison to a CSV File
#2
I dont know what do you want to use as the keys in your dictionary, but equivalent of your csv would be probably list containing your "rows"

elements = driver.find_elements_by_xpath("//ul[@id='AssociationList_listbox']/li")
elements_list = []
for element in elements:
      elements_list.append(str(element.text))
If you had some unique (and hashable) key for each element, you could just change elements_list to a dictionary and instead of appending use elements_dict[key] = str(element.text)
Reply


Messages In This Thread
RE: Create Dictionary List (From a webpage dropdown) for Comparison to a CSV File - by zivoni - Mar-30-2017, 01:32 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Generating dynamic dropdown list test 1 1,569 Aug-30-2023, 08:00 AM
Last Post: blessinguvula
  Python Selenium (Dropdown-) data Robin_at_Cantelli 2 6,259 Dec-29-2021, 03:16 AM
Last Post: ondreweil
  Selenium Python for Dropdown not working gj31980 1 2,755 Oct-27-2020, 02:02 AM
Last Post: gj31980
  Dropdown interact moisesfelipee 0 1,723 May-04-2020, 01:11 AM
Last Post: moisesfelipee
  While loop skips multiple dropdown menu options and then works as intended newbie_programmer 1 2,942 Dec-23-2019, 10:26 PM
Last Post: keuninkske
  Create .exe file for Python flask website. vintysaw 4 19,560 Nov-18-2019, 07:56 AM
Last Post: tonycstech
  How can i scrape dropdown value ? caca 0 3,035 Nov-03-2019, 11:24 PM
Last Post: caca
  Python Flask Dependent Dropdown Anfaa 3 18,588 Oct-24-2018, 09:35 PM
Last Post: nilamo
  Click dropdown menu option with Selenium PyChrome AcszE 3 6,019 Oct-26-2017, 10:07 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