Inner nested class access from robot framework

后端 未结 2 852
一生所求
一生所求 2021-01-28 19:23

Robot - 3.1.1 Python - 3.7.3

I wanted to access method that are written in nested inner class from robot framework.

Robot:

*** S         


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-28 19:54

    When Robot Framework imports a library, it tries to import just the class named the same as the .py file - as in your case, the class OrderList in the OrderList.py file. And it doesn't import any other classes - check the documentation for more details.

    The easiest option would be to have the class you are going to use renamed, to the same name as the file.

    If that's not applicable - and looks like your intent is to use more than one class, you could have the file in your PYTHONPATH (like, physically moving the file to a dir in it, or extend it to include the module's one) and import the classes separately as OrderList.Ordertable.
    Another would be to solve it on the python side - put each class in a module of their own, each importing the one with the base class.

    The first is ops nightmare, the second - design & maintenance; your choice :).

提交回复
热议问题