HelperUtils/CommonAutomationFunction_Util.py
import pywinauto
class CommonAutoLib():
"""
"""
_logger = None
_autoWait = None
_yamlContent = None
def __init__(self):
super().__init__()
self._logger = super()._init_logger()
self._CommonGUILocators = self.loadAndReturnYAMLFile('GUILocators/CommonGUILocators.yaml')
加载配置文件.py
from HelperUtils.CommonAutomationFunction_Util import CommonAutoLib
CommonGUILocators = CommonAutoLib().loadAndReturnYAMLFile('GUILocators/CommonGUILocators.yaml')
我正在尝试将 CommonAutomationFunction_Util.py 的
__init__
方法调用到 LoadProfile.py。附上图片供参考
在 LoadProfile.py 文件中创建一个类,并从单独的主文件中调用该类。看起来像下面这样
加载配置文件.py
from HelperUtils.CommonAutomationFunction_Util import CommonAutoLib
class LoadProfile:
def __init__(self):
CommonGUILocators = CommonAutoLib().loadAndReturnYAMLFile('GUILocators/CommonGUILocators.yaml')
main.py
from <filePath> import LoadProfile
LoadProfile()