Get all items in local storage. Returns: A dict mapping keys to values.
(self)
| 58 | return int(self.driver.execute_script("return window.localStorage.length;")) |
| 59 | |
| 60 | def items(self) -> dict[str, str]: |
| 61 | """Get all items in local storage. |
| 62 | |
| 63 | Returns: |
| 64 | A dict mapping keys to values. |
| 65 | """ |
| 66 | return self.driver.execute_script( |
| 67 | "var ls = window.localStorage, items = {}; " |
| 68 | "for (var i = 0, k; i < ls.length; ++i) " |
| 69 | " items[k = ls.key(i)] = ls.getItem(k); " |
| 70 | "return items; " |
| 71 | ) |
| 72 | |
| 73 | def keys(self) -> list[str]: |
| 74 | """Get all keys in local storage. |
no outgoing calls