Truncate a CSS selector to a maximum length, adding ellipsis if truncated.
(selector: str, max_length: int = 35)
| 5 | |
| 6 | |
| 7 | def truncate_selector(selector: str, max_length: int = 35) -> str: |
| 8 | """Truncate a CSS selector to a maximum length, adding ellipsis if truncated.""" |
| 9 | return selector if len(selector) <= max_length else f'{selector[:max_length]}...' |
| 10 | |
| 11 | |
| 12 | async def get_best_element_handle(page, selector, params=None, timeout_ms=100): |
no outgoing calls
no test coverage detected