I'm a bit fresh with Python (doing usually C# stuff).. I am trying to use another function that was defined in the same class and for some reason I cannot access it.
class runSelenium:
def printTest():
print('This works')
def isElementPresent(locator):
try:
elem = driver.find_element_by_xpath(locator)
bRes = True
except AssertionError:
print('whatever')
else:
return False
def selenium():
driver = webdriver.Firefox()
driver.get("https://somesite.com/")
printTest()
isPresent = isElementPresent("//li[@class='someitem'][60]")
When trying to use printTest() and isElementPresent() I get: function not defined.. This is probably something ultra trivial I don't understand in Python.. Thanks for help!
selfas the first parameter. To call another function in the class, doself.first.classindent the whole thing. Indentation is part of the syntax in python, it's not for decoration.