In Python/Selenium, I am trying to create a browser class mainly so I can create custom functions like click or type, etc and easily call these by typing something simple such as browser.click(element) or browser.type_text(element, text).
I think I am sort of on the right track but I cannot get the inheritance to work. For example, when I create a browser instance with browser = Browser() and try to use the normal functions of webdriver like browser.get(webpage), I get an error stating that there is no GET function. Am I on the right track here? Is there a better way?
class Browser(webdriver.Chrome):
def __init__():
super(self).init()
self.browser = webdriver.Chrome()
def click(element):
WebDriverWait(self, 10).until(EC.element_to_be_clickable(element)).click()
browser = Browser()
element = (By.ID, elements['remember'])
browser.click(element)