Look up an element by id. The '#' prefix is optional and will be stripped if present. Returns None if no element with that id exists. ```python page["my-id"] # Element with id="my-id" (or None) page["#my-id"] # Same as above (# is optional)
(self, key)
| 1407 | self.head = Element.wrap_dom_element(document.head) |
| 1408 | |
| 1409 | def __getitem__(self, key): |
| 1410 | """ |
| 1411 | Look up an element by id. |
| 1412 | |
| 1413 | The '#' prefix is optional and will be stripped if present. |
| 1414 | Returns None if no element with that id exists. |
| 1415 | |
| 1416 | ```python |
| 1417 | page["my-id"] # Element with id="my-id" (or None) |
| 1418 | page["#my-id"] # Same as above (# is optional) |
| 1419 | ``` |
| 1420 | """ |
| 1421 | return _find_by_id(document, key) |
| 1422 | |
| 1423 | @property |
| 1424 | def title(self): |
nothing calls this directly
no test coverage detected