Simon GIS
Simon GIS

Reputation: 1055

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?

enter image description here

Upvotes: 0

Views: 71

Answers (1)

Pedro Maia
Pedro Maia

Reputation: 2712

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

Upvotes: 1

Related Questions