pywinauto

python --> pyinstaller - .exe file will return “test returned -1”

痞子三分冷 提交于 2019-12-10 22:45:21
问题 [1] The code is: import Tkinter from Tkinter import * # Create Tk instance root = Tkinter.Tk(className="test") # Open Notepad def openNotepad(): import pywinauto app = pywinauto.Application.start("notepad.exe") # Add menu menu = Menu(root) root.config(menu=menu) filemenu = Menu(menu) menu.add_cascade(label="01 File", menu=filemenu) filemenu.add_command(label="New", command=openNotepad) # Pack all root.mainloop() [2] The code works if I double click on .py file. If I leave only the openNotepad

Using PyWinAuto (or anything else) to interact with hidden icons on the taskbar

拈花ヽ惹草 提交于 2019-12-10 06:58:11
问题 I am trying to find and click a hidden icon on the taskbar (shown by clicking the white triangle) in windows 7, using python. I've been trying to use pywinauto for this, but it doesn't seem to have the functionality to find and click one of these hidden icons. Even the taskbar module in pywinauto doesn't work (possibly due to being outdated). How can I do this? The application I am trying to access for automation can only be shown by clicking on its hidden icon in the taskbar. By hidden icon,

SendKeys method of AutoIT, shell script or pywinauto lib is not working

随声附和 提交于 2019-12-08 12:50:16
问题 Scenario is, I want to handle IE pop up in robot framework with python. To handle pop up, I used AutoIT SendKeys, shell script, pywinauto TypeKeys. The code is working properly when running on a local machine but when I run the script through team city on the agent machine, then it fails. My observation is that in the agent machine the code is not working to handle the windows pop up. After analysis, I have found that this is because the agent machine is working as a locked system while

GUI测试自动化 -- python

。_饼干妹妹 提交于 2019-12-08 01:24:32
#! /usr/bin/env python #coding=GB18030 ''' GUI测试自动化 语言:python 模块:pywinauto 环境:windows7中文、python-2.6_32bit、pywinauto-0.40、SendKeys-0.3 FuncName: pywinauto_notepad.py Desc: study pywinauto Date: 2017-4-10 10:30 Author: 雷小莫_code Home:http://write.blog.csdn.net/postedit?ref=toolbar&ticket=ST-9487-pv1otSnSmsC29jQWT4wc-passport.csdn.net ''' from pywinauto import application import SendKeysCtypes import time class Pywin(object): """ pywin framwork main class tool_name : 程序名称,支持带路径 windows_name : 窗口名字 """ SLEEP_TIME = 1 def __init__(self): """ 初始化方法,初始化一个app """ self.app = application.Application()

how to switch between two application using pywinauto 0.5.4

拜拜、爱过 提交于 2019-12-07 07:20:29
I am trying to automate a task of copying every single line one by one from Notepad and pasting it the application and then clicking at a button and then copying the output to a third notepad file. I am using pywinauto 0.5.4 of python for this automation and I am not getting any help on how to switch between different application from pywinauto import application app = application.Application() app = application.Application() app.start("Notepad.exe") app.start("C:\Program Files (x86)\eSpeak\eSpeakedit.exe") I am using this code for starting two apps. How to switch between these two application

How can I get a url from Chrome by Python?

岁酱吖の 提交于 2019-12-06 14:05:16
问题 I'm trying to use Pywinauto to get the Chrome tab's url like this: (pseudo code) Press F6 to direct url line. Ctrl + C to copy url Get the url from scrapbook Deal with the url by BS4, Requests, selenium and etc. I am done with step 1 and stuck at step 2. Again, I don't know how to deal with step 3. Thus, think the method I figure out is incorrect and not efficient. Can anybody suggest what I should do or give me a better way? 回答1: Just to summarize all the comments in one answer... pywinauto

pywinauto: How to select this dialog? Which spying tool to use? What information do I need on it?

随声附和 提交于 2019-12-06 10:25:39
问题 How can I write "hello" on the first field of the 7-zip "Add to Archive" dialog? I managed so far to trigger the 7-zip (windows 64x) "Add to Archive" dialog using this from pywinauto.application import Application app = Application().start(r"C:\Program Files\7-Zip\7zFM.exe") #set the app app.top_window_().Edit.type_keys(r"C:\Users\me\Desktop{ENTER}") app.top_window_().SysListView32.Select(r'test.txt') #select files in list app.top_window_().ToolbarAdd.TypeKeys("{ENTER}") #apply Then I can't

How to send SendKeys to Windows form in python script?

主宰稳场 提交于 2019-12-06 06:23:53
I'm doing automation scripting in Python for my desktop application. In that I'm sending TAB key/any key to my windows form. But I'm not able to find handle of that Windows form in my Python script. Here is the sample code snippet : __author__ = 'juhis' import SendKeys import sys import os from Tkinter import * import ctypes import win32gui import pywinauto pwapp = pywinauto.application.Application() whandle = pywinauto.findwindows.find_windows(title_re='Form1',class_name='WindowsForms10.Window.8.app.0.2bf8098_r13_ad1')[0] window1 = pwapp.window_(handle=whandle) window1.SetFocus() SendKeys

Using PyWinAuto (or anything else) to interact with hidden icons on the taskbar

ⅰ亾dé卋堺 提交于 2019-12-05 16:23:54
I am trying to find and click a hidden icon on the taskbar (shown by clicking the white triangle) in windows 7, using python. I've been trying to use pywinauto for this, but it doesn't seem to have the functionality to find and click one of these hidden icons. Even the taskbar module in pywinauto doesn't work (possibly due to being outdated). How can I do this? The application I am trying to access for automation can only be shown by clicking on its hidden icon in the taskbar. By hidden icon, I mean in the notification area. I've tried pywinauto.taskbar.SystemTrayIcons, but the DrawOutline

记录Pywinauto(大众签章)

折月煮酒 提交于 2019-12-05 04:29:15
from pywinauto.application import Application # 打开一个记事本(如果已经打开,可以忽略) app = Application().start("notepad.exe") # 绑定进程,class_name和title是可选的,可以灵活使用,如果找到多个货没有找到该程序,程序会报错 方法一:app = Application().connect(class_name="Notepad",title="无标题 - 记事本") 方法二:app = Application().connect(path=“F:\software\ABBYY FineReader 12\FineReader.exe”绝对路径) # 得到可操作的窗口,可以传入标题,类名,或者将标题传入键值 win = app.window(title="无标题 - 记事本") # 或者(通常使用此方法) win = app["无标题 - 记事本"] # 可以使用Edit对可编辑区进行编辑 win.Edit.type_keys('test.txt') win.menu_select("文件->保存") # 当弹出新的窗口时,窗口标题变化,因此需要重新确定可操作窗口 win = app['另存为'] win.Edit.type_keys('test.txt') #