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

0 votes
May 27, 2019 in Selenium by Zakir
1,964 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, 2019 by Abha
• 28,140 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 28, 2018 in Selenium by nsv999
• 5,500 points
27,384 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, 2019 in Selenium by Anvi
• 14,150 points
904 views
–1 vote
1 answer
+1 vote
1 answer

Can I get meta-description of a webpage using selenium webdriver with python?

Hi Arpit, you can use this code ...READ MORE

answered Jul 31, 2019 in Selenium by Anvi
• 14,150 points
4,121 views
0 votes
1 answer

Installing Selenium Webdriver with Python package

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

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,850 views
0 votes
2 answers

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,500 points
13,687 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,149 views
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,910 points
7,230 views
0 votes
1 answer

Taking screenshot of a webpage with Python-Selenium. How it can be done?

Hi Babita, try using this piece of ...READ MORE

answered May 27, 2019 in Selenium by Abha
• 28,140 points
1,071 views
0 votes
1 answer

How can I add Cucumber Jar files in Eclipse to use with Selenium Webdriver?

Hey Eshan, follow these steps to add ...READ MORE

answered May 23, 2019 in Selenium by Abha
• 28,140 points
5,980 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP