How to separate h3 and content p in h3 example by selenium python

Viewed 28

hi i try to extract content this url to dictionary by python: data={h3title: h3content,...} this url: https://www.masculinedevelopment.com/she-never-texts-first/ anyone can help me indicate problem in this code :

data = dict((e.text,'') for e in driver.find_elements(By.CSS_SELECTOR,'.elementor-widget-container h3'))

for p in driver.find_elements(By.CSS_SELECTOR,'.elementor-widget-container p:not(aside>p)'):        
    
    data[p.find_element(By.XPATH, './preceding-sibling::h3[1]').text] = data[p.find_element(By.XPATH, './preceding-sibling::h3[1]').text]+' '+p.text
0 Answers
Related