Home > Net >  Getting all text elements with Selenium
Getting all text elements with Selenium

Time:10-31

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

CodePudding user response:

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
  • Related