How to extract the URL of a particular page using selenium/python?


I’m building an instagram Bot using selenium.
How do I extract the URL of a page using python?

For example Selenium is loading a webpage. I want to extract the url of that particular page .(Suppose :

If you still don’t understand what I’m talking about, please check the image below. There, I have highlighted the page link. How do I extract that link?

enter image description here



def current_url(self):
    Gets the URL of the current page.

    return self.execute(Command.GET_CURRENT_URL)['value']

This means that in order to get a current url you can use:

your_url = driver.current_url

But first you need for this page to open.

Answered By – vitaliis

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published