botcity-dev / botcity-framework-web-python

BotCity Framework Web - Python
https://documentation.botcity.dev/frameworks/web/
Apache License 2.0
40 stars 19 forks source link

wait_for_file not working with .part files on Firefox. #55

Closed lf2a closed 2 years ago

lf2a commented 2 years ago

Describe the bug It is not waiting for the download to finish because there is no 100MB.bin.part file, Firefox creates a 100MB.<hash>.bin.part file

https://github.com/botcity-dev/botcity-framework-web-python/blob/b62372c68b8212519eb20093dfabbfb1287f36e9/botcity/web/bot.py#L2001

Expected behavior Wait for the download to finish and the .part file to be deleted.

Steps to Reproduce

from botcity.web import WebBot, Browser, By, browsers
from webdriver_manager.firefox import GeckoDriverManager

web = WebBot()
web.driver_path = GeckoDriverManager().install()
web.browser = Browser.FIREFOX
web.headless = False

web.browse("https://speed.hetzner.de/")
element = web.find_element(by=By.XPATH, selector="/html/body/p[1]/a")
element.click()

self.wait(2_000)

if not web.wait_for_file('/home/luiz/Downloads/100MB.bin', 5_000):
    print('tiemout')

Possible Solution It could be checked if the file has more than 0 bytes.

My Platform