How can I extract all the links from a webpage with Selenium Python?

How can I extract all the links from a webpage with Selenium Python?

Hey there Charity,

You can extract all the links from a webpage using Selenium-Python, from Selenium Import WebDriver.

options = webdriver.ChromeOptions()
options.add_argument('--ignore-certificate-errors')
options.add_argument("--test-type")
driver = webdriver.Chrome("C:\\\\Users\\\\Abha_Rathour\\\\Downloads\\\\ExtractedFiles\\\\chromedriver_win32\\\\chromedriver.exe" ,chrome_options=options)

driver.get('https://www.w3.org/')

for a in driver.find_elements_by_xpath('.//a'):
print(a.get_attribute('href'))

driver.close()