-2

I have an window application that install in pc, I wish to used Python code to auto click on a icon after the application open. Below is my application look:

enter image description here

from this case I wish to used code to look for the Excel Icon and auto click it, the purpose of this icon is download the data.

I cannot used webdriver function because this is not the web application and this application don't have any coding behind, that mean when i run on Sample.exe it will direct pop up this window as the picture shown here.

Anyone have any idea on this?

Shi Jie Tio
  • 2,479
  • 5
  • 24
  • 41

1 Answers1

4

import pyautogui while True: iconX, iconY = pyautogui.locateCenterOnScreen('icon.png') pyautogui.doubleClick(iconX, iconY)

There are many different types of modules that you can use in order to achieve this but the one i would recommend is python auto GUI. This allows for screen searches and control over peripherals such as a mouse and keyboard. The code is relatively simple and is very basic. You can install it using the pip function using pip install pyautogui.

The code to achieve something like you say is one of the first things you will be able to do and if you need further help then feel free to ask but for convenience I will drop a website with the following functions.

https://pypi.org/project/PyAutoGUI/

I shall provide a demo code above.