Search code examples
pythonui-automationpywinauto

pywinauto: how to get rid of delays in clicks


import time
from pywinauto.application import Application
import os

#Installer path
pycharm_exe = r"G:\Softwarewa\JetBrains PyCharm\JetBrains PyCharm Professional 2023.1 [FileCR]\JetBrains PyCharm Professional 2023.1\pycharm-professional-2023.1.exe"

app = Application(backend="uia").start(pycharm_exe)

# Wait for window to appear
while True:
    if app.PyCharmSetup.exists() == True:
        break

#activate the window
app.PyCharmSetup.window()

# app.PyCharmSetup.print_control_identifiers()
app.PyCharmSetup.Next.click()

#click on next again
app.PyCharmSetup.Next.click()

#click on next once again
#app.PyCharmSetup.print_control_identifiers()

hi there, i am trying to automate PyCharm installation but there is a problem with script when it reaches where it starts to click on "Next" button it takes about 3 sec to click next button again.... how do i get rid of these delays between clicks?


Solution

  • You need to modify global timings. See the bottom of this guide:

    https://pywinauto.readthedocs.io/en/latest/wait_long_operations.html#global-timings-for-all-actions

    But please be careful, especially about setting all timings to zero. It may affect reliability of the automation steps. Because often some time is needed to handle some events at the app side. Maybe Timings.fast() is better in general.