I have the following class:
class Sections(BasePage):
CHOOSE_SECTION_SEL = (By.XPATH, "//*[@class='select2-result-label' and (text() = '" + state + "')]")
def choose_section(self, state):
self.click_on_element("choose section", self.CHOOSE_SECTION_SEL)
Then I want to call it like this so I can change the variable 'state' whatever I want but it is not working obviously:
section = Sections(driver=self.driver)
section.choose_section(state="CALENDAR")
I know I can do it like this and it is working:
class Sections:
def section(self, state):
driver.find_element_by_xpath("//*[@class='select2-result-label' and (text() = '" + state + "')]").click()
...
choose = Sections()
choose.section(state="CALENDAR")
However I have to do it like the first example. Any ideas what I have to change?