Get Current URL

To get the current URL in Python using Selenium, you can use the current_url property of the WebDriver instance. Here’s how you can do it:

from selenium import webdriver

# Example using Chrome WebDriver
driver = webdriver.Chrome()

# Navigate to a website
driver.get("https://sqatools.in/")

# Get the current URL
current_url = driver.current_url
print("Current URL:", current_url)

# Close the browser
driver.quit()

This will print the current URL of the page that the WebDriver is on.