Using python selenium, how to find all the links with the same text in a list?
I can use the following code to find a link that has the text '...'
button = driver.find_element_by_link_text('...')
But I have more than one of these on the page and would like to click the second one.
find_element_by_
returns the first WebElement
matching the search criteria. To get all the matching WebElement
s use find_elements_by_
driver.find_elements_by_link_text('...')
您可以使用find_elements_by_link_text
:
driver.find_elements_by_link_text('...')[1].click()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.