text_contents = [el.text for el in driver.find_elements_by_xpath(
    "//ul[@id='myId']/li")]
for text in text_contents:
    pass
How to get a list of the <li> elements in an <ul> with Selenium in Python?