How to find multiple elements with the same path on the same page using Selenium Xpath
I am trying to pull data "Text I Want" with selenium using python.
The code I used below only pulled out the first one.
e = driver.find_element_by_xpath('.//*[@class = "sth3"]/span')
e.text
What should I do? 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>
+3
source to share
2 answers