简体   繁体   中英

Python OOP method call

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?

You can add ClickElement as a composed object in Automation

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM