Need a little help understanding what I am doing wrong. Probably pretty basic, but I haven't wrapped my brain around it.
My code is this:
class baseElement(object):
def __init__(self):
self.Portal = ''
self.locator = ''
def present(self):
return self.Portal.PTF.Presence_of_Element(self.locator)
def visible(self):
return self.Portal.PTF.Is_Element_Visible(self.locator)
class baseActiveElement(baseElement):
def hover(self):
self.Portal.PTF.Mouse_over_element(self.locator)
def click(self):
self.Portal.PTF.Click_on_Element(self.locator)
def get(self):
return self.locator
I define the Portal when I instantiate objects from these bases and it includes some functions to perform the specified actions. This works. No problems there.
But pylint complains thusly:
E1101: 8,15:baseElement.present: Instance of 'str' has no 'PTF' member
E1101: 11,15:baseElement.visible: Instance of 'str' has no 'PTF' member
E1101: 15,8:baseActiveElement.hover: Instance of 'str' has no 'PTF' member
E1101: 18,8:baseActiveElement.click: Instance of 'str' has no 'PTF' member
What should I be doing to not cause this error?
Edit: If I change my init to this:
class baseElement(object):
def __init__(self):
self.Portal = object
self.Portal.PTF = self.Portal.PTF
self.locator = ''
The pylint objection goes away, and I can see the value of defining portal as a base object, since it will eventually be a real object, but defining Portal.PTF as itself looks like nonsense to me.