示例#1
0
 def __init__(self):
     self.app = Application(backend='uia').start(
         r'C:\\Program Files\\Microsoft Office\\root\\Office16\\winword.exe'
     )
     self.main = self.app.window(title='Document1 - Word')
     # self.main = self.app.active()
     utility_method_class.customLog().info(
         "Word application is launched and first document page is opened")
     time.sleep(10)
def test_wordHello():
    # subprocess.call("taskkill /IM WINWORD.EXE /F", shell=True)
    with allure.step(
            "TC_ID_001: Launch Word to verify if the user is able to write"):
        try:
            word.typeHello()
            utility_method_class.customLog().info(
                "Verify that Hello is written in word ")
        except AssertionError as e:
            utility_method_class.customLog().error('unable to write hello' + e)
            raise e
def test_typeBold():
    with allure.step(
            "TC_ID_002: Launch Word to verify if the bold and Save functionality is working "
    ):
        try:
            word.typeBold()
            word.saveWord()
            word.closeFile()
            utility_method_class.customLog().info(
                "Verify that Hello is written in bold in word ")
        except AssertionError as e:
            utility_method_class.customLog().error(
                'unable to write bold hello' + e)
            raise e
def mspatchReadPropertyKeyValue(section, key):
    cfg = ConfigParser()
    cfg.read(MS_Patch_filepath)
    # utility_method_class.customLog().info('File path of the configuration---->   '+ filepath)
    try:
        if section in cfg.sections():
            value = cfg.get(section, key)
            return value

    except FileNotFoundError as e:
        utility_method_class.customLog().error('File not found' + e)
    except NoSectionError as e:
        utility_method_class.customLog().exception(
            'Defined section is not present ' + e)

    else:
        utility_method_class.customLog().info(
            'Unable to process the .ini config file ')
示例#5
0
 def typeHello(self):
     self.main.child_window(title="Page 1 content",
                            auto_id="Body",
                            control_type="Edit").type_keys("Hello Pywin")
     utility_method_class.customLog().info("Hello is written")
示例#6
0
 def maximize_app_window(self):
     # Access app's window object
     self.main.maximize()
     utility_method_class.customLog().info(
         "Word application is launched and Maximized")