本文整理汇总了Python中pywinauto.sysinfo.is_x64_Python函数的典型用法代码示例。如果您正苦于以下问题:Python is_x64_Python函数的具体用法?Python is_x64_Python怎么用?Python is_x64_Python使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_x64_Python函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testClickVisibleIcon
def testClickVisibleIcon(self):
"""
Test minimizing a sample app into the visible 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 disabled
orig_hid_state = _toggle_notification_area_icons(
show_all=True,
debug_img="%s_01" % (self.id())
)
self.dlg.Minimize()
_wait_minimized(self.dlg)
# click in the visible area
taskbar.explorer_app.WaitCPUUsageLower(threshold=5, timeout=self.tm)
taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
self.dlg.Wait('active', timeout=self.tm)
# Restore Notification Area settings
_toggle_notification_area_icons(show_all=orig_hid_state,
debug_img="%s_02" % (self.id()))
示例2: setUp
def setUp(self):
"""Start the application set some data and ensure the application
is in the state we want it."""
# start the application
self.app = Application()
if is_x64_Python() or not is_x64_OS():
self.app.start_(r"C:\Windows\System32\notepad.exe")
else:
self.app.start_(r"C:\Windows\SysWOW64\notepad.exe")
# Get the old font
self.app.UntitledNotepad.Wait('ready', 50)
self.app.UntitledNotepad.MenuSelect("Format->Font...")
self.app.Font.Wait("visible", 50)
self.old_font = self.app.Font.FontComboBox.SelectedIndex()
self.old_font_style = self.app.Font.FontStyleCombo.SelectedIndex()
# ensure we have the correct settings for this test
self.app.Font.FontStyleCombo.Select(0)
self.app.Font.FontComboBox.Select("Lucida Console")
self.app.Font.OK.Click()
self.dlg = self.app.Window_(title='Untitled - Notepad', class_name='Notepad')
self.ctrl = HwndWrapper(self.dlg.Edit.handle)
self.dlg.edit.SetEditText("Here is some text\r\n and some more")
示例3: testWaitCPUUsageLower
def testWaitCPUUsageLower(self):
if is_x64_Python() != is_x64_OS():
return None
app = Application().Start(r'explorer.exe')
WaitUntil(30, 0.5, lambda: len(findwindows.find_windows(active_only=True, class_name='CabinetWClass')) > 0)
handle = findwindows.find_windows(active_only=True, class_name='CabinetWClass')[-1]
window = WindowSpecification({'handle': handle, })
explorer = Application().Connect(process=window.ProcessID())
try:
window.AddressBandRoot.ClickInput(double=True)
window.Edit.SetEditText(r'Control Panel\Programs\Programs and Features')
window.TypeKeys(r'{ENTER 2}', set_foreground=False)
WaitUntil(30, 0.5, lambda: len(findwindows.find_windows(active_only=True, title='Programs and Features', class_name='CabinetWClass')) > 0)
explorer.WaitCPUUsageLower(threshold=2.5, timeout=40, usage_interval=2)
installed_programs = window.FolderView.Texts()[1:]
programs_list = ','.join(installed_programs)
if ('Microsoft' not in programs_list) and ('Python' not in programs_list):
HwndWrapper.ImageGrab.grab().save(r'explorer_screenshot.jpg')
HwndWrapper.ActionLogger().log('\ninstalled_programs:\n')
for prog in installed_programs:
HwndWrapper.ActionLogger().log(prog)
self.assertEqual(('Microsoft' in programs_list) or ('Python' in programs_list), True)
finally:
window.Close(2.0)
示例4: test_is64bitprocess
def test_is64bitprocess(self):
"Make sure a 64-bit process detection returns correct results"
if is_x64_OS():
# Test a 32-bit app running on x64
expected_is64bit = False
if is_x64_Python():
exe32bit = os.path.join(os.path.dirname(__file__),
r"..\..\apps\MFC_samples\RowList.exe")
app = Application().start_(exe32bit, timeout=20)
pid = app.RowListSampleApplication.ProcessID()
res_is64bit = is64bitprocess(pid)
try:
self.assertEquals(expected_is64bit, res_is64bit)
finally:
# make sure to close an additional app we have opened
app.kill_()
# setup expected for a 64-bit app on x64
expected_is64bit = True
else:
# setup expected for a 32-bit app on x86
expected_is64bit = False
# test native Notepad app
res_is64bit = is64bitprocess(self.app.UntitledNotepad.ProcessID())
self.assertEquals(expected_is64bit, res_is64bit)
示例5: setUp
def setUp(self):
"""Set some data and ensure the application
is in the state we want it."""
mfc_samples_folder = os.path.join(os.path.dirname(__file__), r"..\..\apps\MFC_samples")
if is_x64_Python():
self.sample_exe = os.path.join(mfc_samples_folder, "CmnCtrl1.exe")
else:
self.sample_exe = os.path.join(mfc_samples_folder, 'x64', "CmnCtrl1.exe")
示例6: _get_safe_point_to_click
def _get_safe_point_to_click(self):
"""Run notepad.exe to have a safe area for mouse clicks"""
mfc_samples_folder = os.path.join(
os.path.dirname(__file__), r"..\..\apps\MFC_samples")
if is_x64_Python():
mfc_samples_folder = os.path.join(mfc_samples_folder, 'x64')
sample_exe = os.path.join(mfc_samples_folder, "CmnCtrl1.exe")
self.app = Application()
self.app.start(sample_exe)
self.app.CommonControlsSample.wait("ready")
return self.app.CommonControlsSample.rectangle().mid_point()
示例7: setUp
def setUp(self):
"""Start the application set some data and ensure the application
is in the state we want it."""
self.app = Application()
if is_x64_Python() or not is_x64_OS():
self.app.start(r"C:\Windows\System32\calc.exe")
else:
self.app.start(r"C:\Windows\SysWOW64\calc.exe")
self.calc = self.app.Calculator
self.calc.MenuSelect("View->Scientific")
示例8: setUp
def setUp(self):
"""Start the application set some data and ensure the application
is in the state we want it."""
# start the application
self.app = Application()
if is_x64_Python() or not is_x64_OS():
self.app.start(r"C:\Windows\System32\notepad.exe")
else:
self.app.start(r"C:\Windows\SysWOW64\notepad.exe")
self.dlg = self.app.UntitledNotepad
self.ctrl = HwndWrapper(self.dlg.Edit.handle)
示例9: setUp
def setUp(self):
"""Start the application set some data and ensure the application
is in the state we want it."""
# TODO: re-write the whole test
self.app = Application(backend="native")
if is_x64_Python() or not is_x64_OS():
self.app.start(r"C:\Windows\System32\calc.exe")
else:
self.app.start(r"C:\Windows\SysWOW64\calc.exe")
self.dlg = self.app.Calculator
self.handle = self.dlg.handle
self.dlg.MenuSelect('View->Scientific\tAlt+2')
self.ctrl = UIAElementInfo(self.dlg.handle)
示例10: testConnect_path
def testConnect_path(self):
"Test that connect_() works with a path"
app1 = Application()
app1.start_(_notepad_exe())
app_conn = Application()
app_conn.connect_(path = self.notepad_subpath)
self.assertEqual(app1.process, app_conn.process)
app_conn = Application()
if is_x64_Python() or not is_x64_OS():
app_conn.connect_(path = r"c:\windows\system32\notepad.exe")
else:
app_conn.connect_(path = r"c:\windows\syswow64\notepad.exe")
self.assertEqual(app1.process, app_conn.process)
app_conn.UntitledNotepad.MenuSelect('File->Exit')
示例11: test_app
def test_app(filename):
mfc_samples_folder = os.path.join(os.path.dirname(__file__),
SAMPLE_APPS_PATH)
if is_x64_Python():
sample_exe = os.path.join(mfc_samples_folder, "x64", filename)
else:
sample_exe = os.path.join(mfc_samples_folder, filename)
app = Application().start(sample_exe, timeout=3)
app_path = os.path.normpath(sample_exe).encode('unicode-escape')
try:
yield app, app_path
except:
# Re-raise AssertionError and others
raise
finally:
app.kill_()
示例12: testClickVisibleIcon
def testClickVisibleIcon(self):
"""
Test minimizing a sample app into the visible 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 disabled
orig_hid_state = _toggle_notification_area_icons(
show_all=True,
debug_img="%s_01" % (self.id())
)
self.dlg.minimize()
_wait_minimized(self.dlg)
menu_window = [None]
# Click in the visible area and wait for a popup menu
def _show_popup_menu():
taskbar.explorer_app.wait_cpu_usage_lower(threshold=5, timeout=self.tm)
taskbar.RightClickSystemTrayIcon('MFCTrayDemo')
menu = self.app.top_window().children()[0]
res = isinstance(menu, ToolbarWrapper) and menu.is_visible()
menu_window[0] = menu
return res
wait_until(self.tm, _retry_interval, _show_popup_menu)
menu_window[0].menu_bar_click_input("#2", self.app)
popup_window = self.app.top_window()
hdl = self.dlg.popup_window()
self.assertEqual(popup_window.handle, hdl)
taskbar.ClickSystemTrayIcon('MFCTrayDemo', double=True)
self.dlg.wait('active', timeout=self.tm)
# Restore Notification Area settings
_toggle_notification_area_icons(show_all=orig_hid_state,
debug_img="%s_02" % (self.id()))
示例13: setUp
def setUp(self):
"""Set some data and ensure the application is in the state we want"""
# Force Display User and Deprecation warnings every time
# Python 3.3+nose/unittest trys really hard to suppress them
for warning in (UserWarning, PendingDeprecationWarning):
warnings.simplefilter('always', warning)
mfc_samples_folder = os.path.join(os.path.dirname(__file__),
r"..\..\apps\MFC_samples")
if is_x64_Python():
self.sample_exe = os.path.join(mfc_samples_folder,
"x64",
"CmnCtrl1.exe")
self.sample_exe_inverted_bitness = os.path.join(mfc_samples_folder,
"CmnCtrl1.exe")
else:
self.sample_exe = os.path.join(mfc_samples_folder, "CmnCtrl1.exe")
self.sample_exe_inverted_bitness = os.path.join(mfc_samples_folder,
"x64",
"CmnCtrl1.exe")
示例14: testClickHiddenIcon
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
self.app2 = Application()
self.app2.start(os.path.join(mfc_samples_folder, u"TrayMenu.exe"))
dlg2 = self.app2.TrayMenu
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)
self.app2 = None
示例15: test_connect_path
def test_connect_path(self):
"""Test that connect_() works with a path"""
app1 = Application()
app1.start(_notepad_exe())
app_conn = Application()
app_conn.connect(path=self.notepad_subpath)
self.assertEqual(app1.process, app_conn.process)
app_conn = Application()
if is_x64_Python() or not is_x64_OS():
app_conn.connect(path=r"c:\windows\system32\notepad.exe")
else:
app_conn.connect(path=r"c:\windows\syswow64\notepad.exe")
self.assertEqual(app1.process, app_conn.process)
accessible_modules = process_get_modules()
accessible_process_names = [os.path.basename(name.lower()) for process, name, cmdline in accessible_modules]
self.assertEquals('notepad.exe' in accessible_process_names, True)
app_conn.UntitledNotepad.MenuSelect('File->Exit')