'How to find the correct name of a component, to use it in automation with pywinauto
In my project I need to open the snipping tool and then -> take a screenshot manually-> then automatically save the image
I used this code so I can now open the tool and then take a screenshot but I didn’t find the way to click the save button,
import time,pywinauto from pywinauto.application import Application from pywinauto.keyboard import send_keys
import time,pywinauto
from pywinauto.application import Application
from pywinauto.keyboard import send_keys
def take_scsho():
#we start the application
app= Application().start(cmd_line=u'"C:\Windows\system32\SnippingTool.exe"')
time.sleep(1)
app.SnippingTool.ToolbarNew.click()
#I need something like this
app.SnippingTool.ToolbarSave.click()
when I print_control_identity to know what button exist, I don’t find it ,can someone that have an idea help please
this is the result of the print


this is the snipping tool, I found that there is a way to access the pen and eraser but not the save :(

the way is: using other thing than the name of the window instead of snipintool -> edit
app.Edit.MenuItem(u'&Tooldelay->X').click()
with
X = dict_keys(['&Pen', '&Highlighter', '&Eraser', '', '&Options...'])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
