Вы можете попробовать это:
from selenium import webdriver
import time
from bs4 import BeautifulSoup as soup
d = webdriver.Chrome('/path/to/chromedriver')
d.get('https://www.koodomobile.com/rate-plans?INTCMP=KMNew_NavMenu_Shop_Plans')
def scrape_dropdown(page):
return [[b.get_text(strip=True) for b in i.find_all('div', {'class':'field-content'})] for i in page.find_all('div', {'class':'panel-2col-stacked clearfix panel-display'})]
result = {}
for a, b in zip(soup(d.page_source, 'html.parser').find_all('div', {'class':'filter-wrapper'}), d.find_elements_by_class_name('filter-wrapper')):
b.send_keys('\n')
time.sleep(2)
result[a.h3.text] = scrape_dropdown(soup(d.page_source, 'html.parser'))
Вывод:
{'Bring your own device': [['$30per month', '1 GBof Shock-Free Data', '0minutes', 'Unlimitedincoming messaging', '$30per month', '1 GBofShock-Free™ data.1,2', '0minutes', 'Unlimitedincoming messaging (text & picture)3. $0.60 per outgoing SMS and MMS.', 'Not eligible for tablet devices', 'Additional data $10/100 MB; additional talk rates $0.60/min', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$35per month', '250 MBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$35per month', '250 MBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$45per month', '1 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$45per month', '1 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$50per month', '2 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$50per month', '2 GBofShock-Free™ data1', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$55per month', '4 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$55per month', '4 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$65per month', '7 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$65per month', '7 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']], 'Tab Small': [['$35per month', '250 MBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$35per month', '250 MBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$45per month', '1 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$45per month', '1 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$50per month', '2 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$50per month', '2 GBofShock-Free™ data1', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$55per month', '4 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$55per month', '4 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$65per month', '7 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$65per month', '7 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']], 'Tab Medium': [['$45per month', '1 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$45per month', '1 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$50per month', '2 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$50per month', '2 GBofShock-Free™ data1', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$55per month', '4 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$55per month', '4 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$65per month', '7 GBof Shock-Free Data', 'Unlimitedminutes', 'Unlimitedmessaging', '$65per month', '7 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart'], ['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']], 'Tab Large': [['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']], 'Tab Extra Large': [['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']], 'Tab Extra Extra Large': [['$75per month', '10 GBof Shock-Free Data.', 'Unlimitedminutes', 'Unlimitedmessaging', '$75per month', '10 GBofShock-Free™ data.1,2', 'UnlimitedCanada-wide anytime minutes', 'Unlimitedmessaging (text & picture)3', 'UnlimitedCanada-wide anytime minutesUnlimitedmessaging (text & picture)3Call Display, Voicemail, Call Waiting and Conference Calling', 'Call Display, Voicemail, Call Waiting and Conference Calling', 'Additional data $10/100 MB', '$35 connection fee (including SIM card) applies when purchased in store', '$0 connection fee (including SIM card) when you order online!', 'Add to cart']]}