简体   繁体   中英

Getting all text elements with Selenium

How can I get all text elements with selenium. This is my try, it return None.

    try:
        description = browser.find_element_by_class_name("jobDescriptionText").text
    except:
        description = "None"
        descriptions.append(description)
        print(description)
    
    time.sleep( 5 )

I would like to get all the text between these elements. How I can do that?

在此处输入图片说明

You probably confused yourself link is just a string and checking the html i think you meant id not class , Use:

description = browser.find_element_by_id("jobDescriptionText").text

Instead of:

description = link.find_element_by_class_name("jobDescriptionText").text

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM