Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
futuremotiondev opened this issue Jun 9, 2023 · 1 comment
Open

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

futuremotiondev opened this issue Jun 9, 2023 · 1 comment

Comments

@futuremotiondev
Copy link

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
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants