I searched for a while for this and was surprised that I couldn’t find anything, maybe because it’s easy. I have been programming in python for about 3 months, doing automated testing with selenium webdriver. I thought it would be convenient to inherit a class from my webdriver class to add additional features to it.
from selenium import webdriver
class myPage(webdriver):
def __init__(self):
super(myPage, self).__init__()
def set_up(self):
but when I do this, I get an error →>
File "c:\Users\me\...\myProgram.py", line 6, in <module>
class myPage(webdriver):
TypeError: module.__init__() takes at most 2 arguments (3 given)
When I create myPage object, the code ...
from myProgram import myPage
class Test():
def do(self):
self.browser = myPage.Firefox()
So, it goes through and makes the line self.browser = myPage.Firefox (), and when it starts. __ init __ () somehow it gives three arguments, and I'm not sure where they come from. I am clearly missing something because inheritance is not complicated. Thanks for any help