Question: I am practicing Selenium in Python and I wanted to fetch all the links on a web page using Selenium.

For example, I want all the links in the `href=` property of all the `<a>` tags on <http://psychoticelites.com/>

I've written a script and it is working. But, it's giving me the object address. I've tried using the `id` tag to get the value, but, it doesn't work.

My current script:

```
from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Firefox()
driver.get("http://psychoticelites.com/")

assert "Psychotic" in driver.title

continue_link = driver.find_element_by_tag_name('a')
elem = driver.find_elements_by_xpath("//*[@href]")
#x = str(continue_link)
#print(continue_link)
print(elem)

```

Answer: 
```
driver.get(URL)
time.sleep(7)
elems = driver.find_elements_by_xpath("//a[@href]")
for elem in elems:
    print(elem.get_attribute("href"))
driver.close()

```

Note: Adding delay is very important. First run it in debug mode and Make sure your URL page is getting loaded. If the page is loading slowly, increase delay (sleep time) and then extract.

If you still face any issues, please refer below link (explained with an example) or comment

[Extract links from webpage using selenium webdriver](https://gethowstuff.com/extract-links-webpage-python-selenium-webdriver/)
You can do this by using BeautifulSoup with very easy and efficient way. I have tested the below codes and worked fine for the same purpose.

After this line -

```
driver.get("http://psychoticelites.com/")

```

use the below code -

```
response = requests.get(browser.current_url)
soup = BeautifulSoup(response.content, 'html.parser')
for link in soup.find_all('a'):
    if link.get('href'):
       print(link.get("href"))
       print('\n')

```