pywinauto

How can I get a url from Chrome by Python?

被刻印的时光 ゝ 提交于 2019-12-04 19:41:45
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? Just to summarize all the comments in one answer... pywinauto 0.5.4 is not able to get the URL from Chrome without tricks like TypeKeys and clipboard grabbing. Coming

How to click a 'next' button of a window using python

ⅰ亾dé卋堺 提交于 2019-12-04 16:16:07
I used the below code to connect a opened window(Class type is SunAwtFrame), indeed I able to connect to it. but unable to click next button of it, my doubt is that 'Next' button may reside inside the frame of that window. Even when I use 'swapy' tool, I am unable to navigate through the controls, indeed not showing the controls actually. So, how to switch to frame if it is that case and click the 'Next' button. app2 = application.Application() app2.connect(title_re = u'abc') dialog = app2.abc print dialog next =dialog.Next print next next.Click() When I ran the above code I got the error like

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

蹲街弑〆低调 提交于 2019-12-04 14:42:50
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 select the Add to Archive dialog. 1: This did not work. I guess because it did not find the dialog. If

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

匿名 (未验证) 提交于 2019-12-03 08:28:06
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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 select the Add to Archive dialog. 1: This did not

pywin32 / pywinauto not working properly in remote desktop when it is minimized

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a Jenkins pipeline that executes a program in a remote server that uses pywin to manipulate an application for functional tests. My application works great while I have the remote desktop oppened but when I close the remote desktop and run it from Jenkins, the app gets lost. What I do is to open the app and send an enter key. This is my app: os.startfile("C:\\Program Files (x86)\\SAP\\FrontEnd\\SAPgui\\saplogon.exe") time.sleep(5) handle = win32gui.FindWindow(0, "SAP Logon 740") keyboard = Controller() keyboard.press(Key.enter) So I

SetCursorPos fail with “the parameter is incorrect” after rdp session terminated

此生再无相见时 提交于 2019-12-03 00:16:26
问题 I have application running on win 2008 server. It is using win32 api and it works just fine when i connected to the server with RDP. When i disconnect every call to SetCursorPos end with this failure. Coordinates (arguments) are same for both cases. Any thoughts ? 回答1: If RDP is disconnected, it's impossible to do anything with GUI (no screen, no mouse). There are few workarounds though. Keep RDP open (not in a full screen) and switch to another window on local machine (RDP must not be

pywinauto进阶练习

匿名 (未验证) 提交于 2019-12-02 22:56:40
case1.画图工具简单练习 # _*_coding=utf-8_*_ import time from pprint import pprint import logging from logging import handlers # from pywinauto import actionlogger from pywinauto import Application # import argparse # parser = argparse.ArgumentParser() # parser.add_argument("--log", help = "enable logging", type=str, required = False) # args = parser.parse_args() class Logger(object): level_relations = { ‘ debug ‘ :logging.DEBUG, ‘ info ‘ :logging.INFO, ‘ warning ‘ :logging.WARNING, ‘ error ‘ :logging.ERROR, ‘ crit ‘ :logging.CRITICAL } # 日志级别关系映射 def __init__ (self,logname,filename,level= ‘ info ‘

SetCursorPos fail with “the parameter is incorrect” after rdp session terminated

大城市里の小女人 提交于 2019-12-02 13:15:25
I have application running on win 2008 server. It is using win32 api and it works just fine when i connected to the server with RDP. When i disconnect every call to SetCursorPos end with this failure. Coordinates (arguments) are same for both cases. Any thoughts ? If RDP is disconnected, it's impossible to do anything with GUI (no screen, no mouse). There are few workarounds though. Keep RDP open (not in a full screen) and switch to another window on local machine (RDP must not be minimized). In this case your script will work, but it's not fully automated solution because turning your local

How to control IE Explorer with pywinauto

╄→尐↘猪︶ㄣ 提交于 2019-12-02 12:09:54
问题 Ok, so I want to control a IE Explorer with pywinauto. I would like to select text fields on the page and edit them. Is there a way to do this with pywinauto without clicking where the text field are? The pages will be the same every time, but not the data that is entered into them. The window may not be in the same place every time, so I couldn't do WrapperObject.Click(coords=fixed_pos) . Sample code is preferred. Thanks! 回答1: Unfortunately no. You can control the window of IE, all the