Hi Ruchi, following lines of code can help you in finding qall broken/invalid links on a webpage using python selenium webdriver:
webdriver.get(PAGEURL)
links = webdriver.find_elements_by_css_selector("a")
for link in links:
if (requests.head(link.get_attribute('href')).status_code == 200):
print("Valid link")
else:
print("Broken link")