有没有一种方法可以在不使用 HTML/CSS 元素的情况下跟踪 Selenium 中的上传进度?

Is there a way to track upload progress in Selenium without use of HTML/CSS elements?

有没有一种方法可以在不使用 HTML/CSS 元素的情况下使用 Python > Selenium 来跟踪文件上传的进度?寻找适用于许多站点的通用解决方案,但不知道从哪里开始。

在 Python 中,可以确定请求库的进度,因为您正在分块进行流式传输,但我不知道从哪里开始使用 Selenium,甚至不知道它是否可能。

尝试在性能日志中查找有关上传进度的信息

# Doesn't work for Firefox. Only Chrome
capabilities = webdriver.DesiredCapabilities().CHROME
capabilities["goog:loggingPrefs"] = {"performance": "ALL"}
driver = webdriver.Chrome(desired_capabilities=capabilities)

# upload file

# watch performance logs
for perf_entry in driver.get_log("performance"):
    perf_entry["message"] = json.loads(perf_entry["message"])["message"]
    # check perf_entry