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)
| 555 | |
| 556 | |
| 557 | def 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"]) |
no outgoing calls
no test coverage detected