Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Last active June 29, 2022 17:37
Show Gist options
  • Save SarahElson/0e59120a401a1a6685702fc30da6bda6 to your computer and use it in GitHub Desktop.
Save SarahElson/0e59120a401a1a6685702fc30da6bda6 to your computer and use it in GitHub Desktop.
How To Get Current URL In Selenium Python
from selenium.webdriver.common.by import By
class SeleniumPlaygroundPage:
#url
url = 'https://www.lambdatest.com/selenium-playground/'
#locators
simple_form_demo = (By.XPATH, "//a[normalize-space()='Simple Form Demo']")
# Initializer
def __init__(self, browser):
self.browser = browser
# Interaction methods
def load(self):
self.browser.get(self.url)
def simple_form(self):
simple_form = self.browser.find_element(*self.simple_form_demo)
simple_form.click()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment