I was using the below code snippet to extract the "Locations" link using selenium webdrive in python, but not able to extract the link, was only able to extract the text ("Locations"). Can anyone help me in this?
Link to extract from: https://www.thomasnet.com/company/siemens-corporation-10035100/profile?cov=NA&which=comp&what=Siemens+Corporation&cid=10035100&searchpos=1
Code Snippet used:
lnk_content = driver.find_element(By.XPATH,"//*[@id='__next']/div/div[2]/div/div[1]/div/div/button/span")
lnk = lnk_content.get_attribute("href")
print(lnk)

hrefattribute in the targetedspanelement. Obviously nothing will be extracted.clickevent listener attached to the<button>element that contains thatLocationlink. There is no link to extract contained in the HTML itself. This is probably designed explicitly to prevent web scraping. Using Selenium, you could perhaps click the link and then read the URL of the page that gets loaded.