Home > Enterprise >  Python OOP method call
Python OOP method call

Time:11-11

I have 2 different classes:

Automation and ClickElement

Window = Automation()
click_element = ClickElement()

In the class ClickElement is a method called 'by_span_name(name)'

Now i want to call the method in this way:

Window.click_element.by_span_name(name)

How do i do that? If i try it like this way, Pycharm doesn´t suggest any class after the first dot of Window.click_elem... Does click_element have to inherit form Window?

CodePudding user response:

You can add ClickElement as a composed object in Automation

Window = Automation()
Window.click_element = ClickElement()
  • Related