How can I extract all the links froma webpage with Selenium-Python?

0 votes
May 27 in Selenium by Zakir
27 views

1 answer to this question.

0 votes

Hey Zakir, 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()
answered May 27 by Abha
• 19,130 points

Related Questions In Selenium

+2 votes
2 answers

How can I press ENTER key with the execute_script in selenium python?

The below code containing Keys.ENTER might just ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
5,685 views
0 votes
1 answer

How can I write test scripts in Selenium with python?

Hey Khushi, writing test scripts in Selenium ...READ MORE

answered May 9 in Selenium by Anvi
• 11,690 points
42 views
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8 in Selenium by Anvi
• 11,690 points
108 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,050 points
403 views
0 votes
1 answer
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,130 points
760 views
0 votes
1 answer
0 votes
1 answer