MCPcopy
hub / github.com/reflex-dev/reflex / get_upload_box

Function get_upload_box

tests/integration/test_upload.py:557–575  ·  view source on GitHub ↗

Find the file input belonging to a specific rx.upload.root, by its id. When ``upload_root_id`` is None, returns the first ``input[type=file]`` on the page (the default upload form, which has no id). Args: driver: WebDriver instance. upload_root_id: id of the ``rx.upload

(driver: WebDriver, upload_root_id: str | None = None)

Source from the content-addressed store, hash-verified

555
556
557def get_upload_box(driver: WebDriver, upload_root_id: str | None = None) -> WebElement:
558 """Find the file input belonging to a specific rx.upload.root, by its id.
559
560 When ``upload_root_id`` is None, returns the first ``input[type=file]``
561 on the page (the default upload form, which has no id).
562
563 Args:
564 driver: WebDriver instance.
565 upload_root_id: id of the ``rx.upload.root`` whose file input to return,
566 or None for the default (first) upload form.
567
568 Returns:
569 The matching file input WebElement.
570 """
571 if upload_root_id is not None:
572 return driver.find_element(
573 By.XPATH, f"//*[@id='{upload_root_id}']//input[@type='file']"
574 )
575 return driver.find_element(By.XPATH, "//input[@type='file']")
576
577
578@pytest.mark.parametrize("upload_root_id", [None, "secondary"])

Callers 9

test_upload_fileFunction · 0.85
test_clear_filesFunction · 0.85
test_cancel_uploadFunction · 0.85
test_upload_chunk_fileFunction · 0.85
test_on_dropFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected