clicknium / clicknium-docs

A next-generation GUI automation framework for Web and Desktop Application Testing and Automation.
https://www.clicknium.com
Apache License 2.0
157 stars 15 forks source link

Any way to speed up execution of a script? #64

Open futuremotiondev opened 1 year ago

futuremotiondev commented 1 year ago

I wrote a simple Clicknium script that downloads icons from Iconify. Here's the script:

from time import sleep
from clicknium import clicknium as cc, locator

def main():
    tab = cc.firefox.open("https://icon-sets.iconify.design/fluent-mdl2/")
    sleep(2)
    icons = cc.find_elements(locator.iconify.icon_sets.iconify_icon_selector)
    for icon in icons:
        icon.click()
        downloadBtn = cc.find_element(locator.iconify.icon_sets.download_svg_icon)
        downloadBtn.click()

if __name__ == "__main__":
    main()

It's working great, but I'd like to really turbocharge the process as much as possible. A few questions:

  1. Can I execute downloads in parallel?
  2. Is there any method to speed up the process of locating and clicking on an icon?
  3. Is there any method to speed up the process of clicking on the download button?

Any help greatly appreciated.

DragonLi-Mi commented 1 year ago

The UI operation could be slow if you want to speed it up. It's easy to guess the download URL for icons. You can use find_elements to get the SVG name and use the request module to download the SVG icon. Headless mode can also speed it up. When you get the download urls, you can download in parallel.