How to get current_url using Selenium in Python? Last Updated : 06 Mar, 2020 Comments Improve Suggest changes Like Article Like Report While doing work with selenium many URL get opened and redirected in order to keeping track of URL current_url method is used. The current_url method is used to retrieve the URL of the webpage the user is currently accessing. It gives the URL of the current webpage loaded by the driver in selenium. URL : URL is the abbreviation of Uniform Resource Locator and is defined as the global address of documents and other resources on the World Wide Web, for example, to visit GeeksforGeeks website, you'll go to the URL https://www.geeksforgeeks.org/ . Syntax : driver.current_url Argument : It takes no argument. Return value : It return the URL in string format. Code 1: Python3 # Importing webdriver from selenium from selenium import webdriver # Here chrome webdriver is used driver = webdriver.Chrome() # URL of the website url = "https://www.geeksforgeeks.org/" # Opening the URL driver.get(url) # Getting current URL get_url = driver.current_url # Printing the URL print(get_url) Output : https://www.geeksforgeeks.org/ Code 2: Python3 # Importing webdriver from selenium from selenium import webdriver # Here chrome webdriver is used driver = webdriver.Chrome() # URL of the website url = "https://www.geeksforgeeks.org/" # Getting current URL get_url = driver.current_url # Printing the URL print(get_url) # Opening the URL driver.get(url) # Getting current URL get_url = driver.current_url # Printing the URL print(get_url) Output : data:, https://www.geeksforgeeks.org/ Note: Here "data:, " is printed because at that time no webpage is opened. Comment More infoAdvertise with us Next Article How to get current_url using Selenium in Python? R rakshitarora Follow Improve Article Tags : Python Web Technologies Software Testing Selenium Python-selenium +1 More Practice Tags : python Similar Reads How to Get the Current URL using JavaScript? Here are two different methods to get the current URL in JavaScript.1. Using Document.URL PropertyThe DOM URL property in HTML is used to return a string that contains the complete URL of the current document. The string also includes the HTTP protocol such as ( http://).Syntaxdocument.URLReturn Val 1 min read current_url driver method - Selenium Python Seleniumâs Python Module is built to perform automated testing with Python. Selenium Python bindings provides a simple API to write functional/acceptance tests using Selenium WebDriver. To open a webpage using Selenium Python, checkout â Navigating links using get method â Selenium Python. Just bein 2 min read How to Locate Elements using Selenium Python? Selenium: is an open-source tool that automates web browsers. It provides a single interface that lets you write test scripts in programming languages like Ruby, Java, NodeJS, PHP, Perl, Python, and C#, among others. I personally prefer Python as itâs very easy to write code in python. A browser-dri 3 min read How to Add Chrome Extension using Python Selenium IntroductionSelenium is a tool for browser automation that supports multiple browsers for testing. With webdriver we can use multiple languages like Python, C#, and Java to write the code for automation testing. For Adding a Chrome extension in a browser with Selenium WebDriver allows us to automate 5 min read How to get the current URL using AngularJS ? In this article, we will see how to get the current URL with the help of AngularJS, along with knowing its basic implementation through the examples. This task can be accomplished in 2 ways, i.e., by implementing the $location.absURL() method to get the complete URL of the current page, & the 2n 2 min read How to create GitHub repository using Python Selenium? Prerequisite: Selenium Selenium is a powerful tool for controlling web browsers through programs and performing browser automation. It is functional for all browsers, works on all major OS and its scripts are written in various languages i.e Python, Java, C#, etc, we will be working with Python. Sel 3 min read How to save and load cookies in Selenium using Python In web automation and testing, maintaining session information across different runs of scripts is often necessary. Cookies are a great way to save session data to avoid logging in repeatedly. Selenium, a popular tool for web testing, provides straightforward ways to save and load cookies using Pyth 4 min read How to get text of a tag in selenium - Python? Selenium is a powerful tool for controlling web browsers through programs and performing browser automation. It is functional for all browsers, works on all major OS and its scripts are written in various languages i.e Python, Java, C#, etc, we will be working with Python. In this article, we will w 1 min read How to Run Edge Driver in Selenium Using Eclipse? Selenium is a well-known software used for software testing purposes. Selenium consists of 3 parts. One is Selenium IDE, one is Selenium Webdriver & the last one is Selenium Grid. Among these Selenium Webdriver is the most important one. Using webdriver online website testing can be done. There 3 min read Python - Opening multiple tabs using Selenium Testing is an important concept in software methodology. Software is said to be effective and efficient only if it is bug-free. Testing can be done manually and also via automation. In Python, selenium is used to do automated testing. The selenium package is available, and they are much helpful to a 4 min read Like