Selenium ver 3.141. Chrome driver, Windows 10
Hello,
The objective is to extract the value of HTML DOM Property specifically the id,href and data-download-file-url for each of the images displayed from this website (Selection of this website is purely for educational purpose). While there exist other approach that can be applied to extract all these items, but at the time being, Im using the find_elements_by_xpath approach. Yet, I welcome if someone would like to suggest more efficient approach that I am not aware of.
From the aforementioned website, the Xpath to the target element is
/html/body/main/section[2]/div/div/figure[X]/div
with the capital X indicate the Image label that take the value from 1 to 50, for the aforementioned website. Each figure fall under the class showcase__content.
I tried the following lines
titles_element = browser.find_elements_by_xpath("//div[@class='showcase__content']/a")
# List Comprehension to get the actual repo titles and not the selenium objects.
titles = [x.text for x in titles_element]
However, there no dom properties extracted at the titles_element. Hence the titles produce [].
Im tempted to tried the following also but It give me an error instead
titles_element = browser.find_elements_by_xpath("//figure[1]/div[@class='showcase__content']//@data-download-file-url")
I really appreciate if someone can shed some light about this problem.
Example of the DOM property for Figure 1. The properties are all in pink color.
https://drive.google.com/open?id=190q615C3uXLZUQNI8K4AJYL3Slii1ktO