So I'm currently trying to find all the src links among a list of generated divs. The problem is it shares the same class name and alt tag as other elements on the page so I'm stuck using the xpath. But when I try to use it I am limited to only returning the value that is indexed in the xpath. For example div[3]. How could I get it to find all the elements div[1-inf] and not just one specific one? I discovered position() as a parameter but I haven't had much luck getting it to work. Maybe I'm just not using it right. driver.find_elements_by_xpath("//*[@id='tab-history-flow']/div[3]/a/img").get_attribute('src')
<div style="display:inline-block">
<a target="_blank" title="Inventory Profile" href="http://csgo.exchange/profiles/76561197969720703">
<img class="Avatar" alt="avatar" title="ArieBier | 2015-09-16 18:20:58" style="width:32px;height:32px" src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/df/dfd267c19d759f730e1051ae4657d0100a6b6c0d.jpg">
</a>
</div>
<div style="display:inline-block">
<a target="_blank" title="Inventory Profile" href="http://csgo.exchange/profiles/76561198136313290">
<img class="Avatar" alt="avatar" title="by | 2015-09-17 02:53:25" style="width:32px;height:32px" src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/5d/5d4c06db9ba89f8a945108af10075ebd348cd1ae.jpg">
</a>
</div>
<div style="display:inline-block">
<a target="_blank" title="Inventory Profile" href="http://csgo.exchange/profiles/76561198152970370">
<img class="Avatar" alt="avatar" title="Marn | 2015-10-05 14:40:37" style="width:32px;height:32px" src="https://steamcdn-a.akamaihd.net/steamcommunity/public/images/avatars/ae/ae7878915405c9ad622c9d7fc3b52f3b71ed140a.jpg">
</a>
</div>
What I already tried.
driver.find_elements_by_xpath("//*[@id='tab-history-flow']/div/a/img"[position() < 1000]).get_attribute('src')
driver.find_elements_by_xpath("//*[@id='tab-history-flow']/div[position() < 1000]/a/img").get_attribute('src')