I have the following xpaths:
<a class="btn btn-small downloadlink" rel="nofollow" data-
toggle="tooltip" data-format="ico" data-icon-id="1715795"
href="/icons/1715795/download/ico" data-original-title="Download this
icon in ICO format for use in Windows."><i class="download-icon"></i><b>
ICO</b></a>
<a class="btn btn-small downloadlink" rel="nofollow" data-
toggle="tooltip" data-format="icns" data-icon-id="1715795"
href="/icons/1715795/download/icns" data-original-title="Download this
icon in ICNS format for use in Apple OS X."><i class="download-icon"></i><b>
ICNS</b></a>
(from here: https://www.iconfinder.com/icons/1715795/earth_planet_space_icon#size=128)
Using selenium, I want to select the element that corresponds to the xpath that contains:
data-format="icns"
I've tried something like:
driver.find_element_by_xpath('//*[@data-format="icns"]')
but it gives the following error message:
selenium.common.exceptions.NoSuchElementException: Message: no such
element: Unable to locate element: {"method":"xpath","selector":"//*
[@data-format=icns]"}
Q: How can I select the the second element?
I know I can just copy the xpath from inspection, but this would leave me with a very unstable scraping script. Since tiny changes in the page layout could mean that my xpath expression would no longer be valid.
Thanks in advance!
it doesn't work? - Anderssona[data-format="icns"]- Lucas Tierney