I'm working on a project where I scrape stories from reddit, and I've run into a problem. For each subreddit, the button you click to take you to the post includes the HTML:
<a class="absolute inset-0" slot="full-post-link" href="*the link*" target="_self">The specific code I've tried to test this with is:
<a class="absolute inset-0" slot="full-post-link" href="/r/ProRevenge/comments/cvb3b6/coworker_tried_to_get_me_fired_over_breast/" target="_self"><faceplate-screen-reader-content> #shadow-root (open)<!----><slot><#text></slot> Coworker tried to get me fired over breast implants, so I pulled a reverse uno card.</faceplate-screen-reader-content></a>I want to retrieve this link and go to it, and have tried:
links = driver.find_elements(By.CLASS_NAME, 'absolute inset-0')But when this runs I'm just given an empty array.
For clarification, I did try finding and clicking the button using By.XPATH, which worked just fine. The only thing is I know using XPATHs is really bad practice, and I'd rather find the button through By.CLASS_NAME. The following code gave me what I need:
storyBtn = driver.find_element(By.XPATH, '/html/body/shreddit-app/dsa-transparency-modal-provider/div/div[1]/div[2]/main/div[2]/article[1]/shreddit-post/a[1]')storyBtn.click()url = str(driver.current_url)The link I'm using is: https://www.reddit.com/r/ProRevenge/top/?t=allDoes anyone know what's up?