clicknium-docs
clicknium-docs copied to clipboard
Any way to speed up execution of a script?
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:
- Can I execute downloads in parallel?
- Is there any method to speed up the process of locating and clicking on an icon?
- Is there any method to speed up the process of clicking on the download button?
Any help greatly appreciated.
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.