Skip to content

Instantly share code, notes, and snippets.

@Khrol
Created June 9, 2014 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Khrol/346c2dc64400137e0e5b to your computer and use it in GitHub Desktop.
Save Khrol/346c2dc64400137e0e5b to your computer and use it in GitHub Desktop.
from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.remote.webelement import WebElement
class Link(WebElement):
def get_href(self):
return self.get_attribute('href')
driver = Firefox()
driver.get('http://ya.ru')
element = driver.find_element(By.XPATH, 'id("mail")/a')
element.__class__ = Link
print element.get_href()
driver.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment