当前位置: 首页>>代码示例>>Python>>正文


Python Application.top_window_方法代码示例

本文整理汇总了Python中pywinauto.application.Application.top_window_方法的典型用法代码示例。如果您正苦于以下问题:Python Application.top_window_方法的具体用法?Python Application.top_window_怎么用?Python Application.top_window_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pywinauto.application.Application的用法示例。


在下文中一共展示了Application.top_window_方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_top_window

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
    def test_top_window(self):
        """Test that top_window_() works correctly"""
        app = Application()
        self.assertRaises(AppNotConnected, app.top_window_)
        
        app.start(_notepad_exe())

        self.assertEqual(app.UntitledNotepad.handle, app.top_window_().handle)

        app.UntitledNotepad.MenuSelect("Help->About Notepad")

        self.assertEqual(app.AboutNotepad.handle, app.top_window_().handle)

        app.AboutNotepad.Ok.Click()
        app.UntitledNotepad.MenuSelect("File->Exit")
        app.UntitledNotepad.WaitNot('exists')
        self.assertRaises(RuntimeError, app.top_window_)
开发者ID:Anton-Lazarev,项目名称:pywinauto,代码行数:19,代码来源:test_application.py

示例2: setUp

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
 def setUp(self):
     """Start the application set some data and ensure the application
     is in the state we want it."""
     self.tm = _ready_timeout
     app = Application()
     app.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
     self.app = app
     self.dlg = app.top_window_()
     self.dlg.Wait('ready', timeout=self.tm)
开发者ID:2nty7vn,项目名称:pywinauto,代码行数:11,代码来源:test_taskbar.py

示例3: safari

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
 def safari(self):
     try:
         app = Application()
         app.connect_(path=r"C:\Program Files\Safari\Safari.exe")
         safari = app.top_window_()
         safari.TypeKeys("{F5}")
     except (WindowNotFoundError, ProcessNotFoundError):
         self.safari64()
         pass
开发者ID:Web5design,项目名称:BrowserRefresh-Sublime,代码行数:11,代码来源:__init__.py

示例4: safari64

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
 def safari64(self):
     # Safari can be installed under either Program Files directories when
     # running 64bit Windows. We call this method if the other one errors out.
     try:
         app = Application()
         app.connect_(path=r"C:\Program Files (x86)\Safari\Safari.exe")
         safari = app.top_window_()
         safari.TypeKeys("{F5}")
     except (WindowNotFoundError, ProcessNotFoundError):
         pass
开发者ID:Web5design,项目名称:BrowserRefresh-Sublime,代码行数:12,代码来源:__init__.py

示例5: safari

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
 def safari(self):
     try:
         app = Application()
         app.connect_(path=r'C:\Program Files\Safari\Safari.exe') 
         ie = app.top_window_()
         ie.TypeKeys('{F5}')
         if self.is64bit:
             self.TypeKeys64()
     except (WindowNotFoundError, ProcessNotFoundError):
         self.safari64()
         pass
开发者ID:CompMike,项目名称:BrowserRefresh-Sublime,代码行数:13,代码来源:__init__.py

示例6: testClickCustomizeButton

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
    def testClickCustomizeButton(self):
        "Test click on the 'show hidden icons' button"

        # Minimize to tray
        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # Make sure that the hidden icons area is enabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=False,
                debug_img="%s_01" % (self.id())
                )

        # Run one more instance of the sample app
        # hopefully one of the icons moves into the hidden area
        app2 = Application()
        app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
        dlg2 = app2.top_window_()
        dlg2.Wait('visible', timeout=self.tm)
        dlg2.Minimize()
        _wait_minimized(dlg2)

        # Test click on "Show Hidden Icons" button
        taskbar.ShowHiddenIconsButton.ClickInput()
        niow_dlg = taskbar.explorer_app.Window_(
                class_name='NotifyIconOverflowWindow')
        niow_dlg.OverflowNotificationAreaToolbar.Wait('ready', timeout=self.tm)
        niow_dlg.SysLink.ClickInput()
        nai = taskbar.explorer_app.Window_(
                title="Notification Area Icons",
                class_name="CabinetWClass"
                )
        origAlwaysShow = nai.CheckBox.GetCheckState()
        if not origAlwaysShow:
            nai.CheckBox.ClickInput()
        nai.OK.Click()

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))

        # close the second sample app
        dlg2.SendMessage(win32defines.WM_CLOSE)
开发者ID:2nty7vn,项目名称:pywinauto,代码行数:45,代码来源:test_taskbar.py

示例7: testClickHiddenIcon

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
    def testClickHiddenIcon(self):
        """
        Test minimizing a sample app into the hidden area of the tray
        and restoring the app back
        """

        if is_x64_Python() != is_x64_OS():
            # We don't run this test for mixed cases:
            # a 32-bit Python process can't interact with
            # a 64-bit explorer process (taskbar) and vice versa
            return

        # Make sure that the hidden icons area is enabled
        orig_hid_state = _toggle_notification_area_icons(
                show_all=False,
                debug_img="%s_01" % (self.id())
                )

        self.dlg.Minimize()
        _wait_minimized(self.dlg)

        # Run one more instance of the sample app
        # hopefully one of the icons moves into the hidden area
        app2 = Application()
        app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
        dlg2 = app2.top_window_()
        dlg2.Wait('visible', timeout=self.tm)
        dlg2.Minimize()
        _wait_minimized(dlg2)

        # Click in the hidden area
        taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=40)
        taskbar.ClickHiddenSystemTrayIcon('MFCTrayDemo', double=True)
        self.dlg.Wait('visible', timeout=self.tm)

        # Restore Notification Area settings
        _toggle_notification_area_icons(show_all=orig_hid_state,
                                        debug_img="%s_02" % (self.id()))

        dlg2.SendMessage(win32defines.WM_CLOSE)
开发者ID:2nty7vn,项目名称:pywinauto,代码行数:42,代码来源:test_taskbar.py

示例8: open

# 需要导入模块: from pywinauto.application import Application [as 别名]
# 或者: from pywinauto.application.Application import top_window_ [as 别名]
parser = argparse.ArgumentParser(description='')
parser.add_argument('--csv')

args = parser.parse_args()
csvFile = args.csv
hosts = {}

projectDir=os.path.abspath(os.getcwd())

import csv
with open(csvFile, 'r') as f:
    reader = csv.reader(f)
    hosts = dict((rows[0].strip(),rows[1].strip()) for rows in reader)

for key in hosts.iterkeys():
    app = Application().Start(cmd_line=u'"C:\\Program Files (x86)\\Crestron\\Toolbox\\Toolbox.exe" ')
    installerstoolboxappclass = app.InstallersToolboxAppClass
    installerstoolboxappclass.Wait('ready', timeout=30)
    button = installerstoolboxappclass.Button2
    button.Click()

    editWindow = app.Window_(title="Edit Address")
    editWindow.Wait('ready',timeout=30).TypeKeys(hosts[key]).TypeKeys('{ENTER}')
    #wineditAddressWindowdow.Wait('ready', timeout=30)

    #window.TypeKeys("{TAB 5}")
    #window.TypeKeys("{SPACE}")
    app.top_window_().DrawOutline()

    app.Kill_()
开发者ID:danclegg,项目名称:pywinauto-crestron-easyconfig,代码行数:32,代码来源:loadProgram.py


注:本文中的pywinauto.application.Application.top_window_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。