This section of my Python Selenium (Geckodriver) code is looking for the little element when looking at a pdf that appears on the search page to tell you it’s a pdf when you search, currently it seems like it can find it, because the driver isn’t returning any error’s or anything like that, but when I try to draw dom attributes like the parent node, it’s not returning anything. Weirdly though, it does respond when I ask dom attributes such as height. Does anybody have any suggestions on how I can find the parent node to this element? I need to access the parent for the actual link to the document.
browser.find_element(By.XPATH, '//*[@id="APjFqb"]').click()
browser.find_element(By.XPATH, '//*[@id="APjFqb"]').send_keys(random.choices(a,k=random.randint(1,5)))
y=(browser.find_element(By.XPATH, "//SPAN[contains(text(), 'PDF')]")).get_dom_attribute('parentNode')
print(y)
Small reference image, this is the little detail “pdf” element that it seems like my code is referencing, however this little element isn’t useful to me unless I can actually navigate to the parent, I just need to check that it’s there.