Please go to this page : https://www.McMaster.com Click on screws , in that page , there is no A tag for each item in the list but , if you right click on one of the you will see in your browser tools that the A tag will come up in the div of that item in the page ,
I'm using selenium and python and I want to gather all the hrefs of the A tags of the items in the list but they don't exist by default .
Are you using Internet Explorer (IE)? This website seems to have different code for IE and other browsers.
Try with Edge or Chrome browser
Dear,please use this code and will be working.
driver = webdriver.Chrome("chromedriver/chromedriver")
driver.get('https://www.mcmaster.com/')
#empty list
all_links = []
#locate a tag
links = driver.find_elements_by_xpath("//a[@href]")
for link in links:
#All href links are save to the list
all_links.append(link.get_attribute('href'))
print(all_links)