Scrapping links should be a simple feat, usually just grabbing the src
value of the a tag.
I recently came across this website (https://sunteccity.com.sg/promotions) where the href value of a tags of each item cannot be found, but the redirection still works. I'm trying to figure out a way to grab the items and their corresponding links. My typical python selenium code looks something as such
all_items = bot.find_elements_by_class_name('thumb-img')
for promo in all_items:
a = promo.find_elements_by_tag_name("a")
print("a[0]: ", a[0].get_attribute("href"))
However, I can't seem to retrieve any href
, onclick
attributes, and I'm wondering if this is even possible. I noticed that I couldn't do a right-click, open link in new tab as well.
Are there any ways around getting the links of all these items?
Edit: Are there any ways to retrieve all the links of the items on the pages?
i.e.
https://sunteccity.com.sg/promotions/724
https://sunteccity.com.sg/promotions/731
https://sunteccity.com.sg/promotions/751
https://sunteccity.com.sg/promotions/752
https://sunteccity.com.sg/promotions/754
https://sunteccity.com.sg/promotions/280
...
Edit: Adding an image of one such anchor tag for better clarity:
document.querySelector('#__layout > div > div > main > div > div > div.collection-list.promotion-list.block-list > ul > li.first > div').click()
will open the first promotion, which means there's no hidden href in the<a>
tag, but instead it's calling Javascript on that page. The<a>
tag is misleading because it's probably there just to change the mouse pointer when hovering over the promotion. – Toshikotoss<a>
tag with nothref
/onclick
, where as you mentioned about retrieve anyhref
,onclick
attributes. – Responsum