The following error is raised when running the below script:
requests.exceptions.MissingSchema: Invalid URL 'None': No schema supplied. Perhaps you meant http://None?
I saw one solution which said to find elements by xpath but as I said I am new I am unable to replicate the code.
import requests
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
option = webdriver.ChromeOptions()
option.add_argument("headless")
driver = webdriver.Chrome(options=option)
driver.get("https://charities.govt.nz/")
links = driver.find_elements_by_css_selector("a")
print("Number of links : %s" %len(links))
for link in links:
r = requests.head(link.get_attribute('href'))
print(link.get_attribute('href'), r.status_code)
A point in the right direction would be appreciated.