How to find multiply elements with same path in one page using Selenium Xpath

Viewed 600

I try to pull the 'Text I Want' data with selenium using python.

The code I used below only pull the first one.

e = driver.find_element_by_xpath('.//*[@class = "sth3"]/span')
e.text

What should I do? The page source below:

<li id = "12345" class = "sth">
 <div class = "sth1">
  <div class = "sth2">
   <a>
    <div class = "sth3">
     <span class = "sth4">Text I Want</span>
<li id = "12345" class = "sth">
 <div class = "sth1">
  <div class = "sth2">
   <a>
    <div class = "sth3">
     <span class = "sth4">Text I Want</span>
2 Answers
Related