@selenium/atoms 4.51.0 → 4.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/dist/typescript/accessibility-snapshot-wire.d.ts +4 -0
- package/dist/typescript/accessibility-snapshot-wire.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot-wire.js +18 -0
- package/dist/typescript/accessibility-snapshot-wire.js.map +1 -0
- package/dist/typescript/accessibility-snapshot.d.ts +3 -0
- package/dist/typescript/accessibility-snapshot.d.ts.map +1 -0
- package/dist/typescript/accessibility-snapshot.js +18 -0
- package/dist/typescript/accessibility-snapshot.js.map +1 -0
- package/dist/typescript/active-element.d.ts +2 -0
- package/dist/typescript/active-element.d.ts.map +1 -0
- package/dist/typescript/active-element.js +19 -0
- package/dist/typescript/active-element.js.map +1 -0
- package/dist/typescript/clear-local-storage.d.ts +3 -0
- package/dist/typescript/clear-local-storage.d.ts.map +1 -0
- package/dist/typescript/clear-local-storage.js +25 -0
- package/dist/typescript/clear-local-storage.js.map +1 -0
- package/dist/typescript/clear-session-storage.d.ts +3 -0
- package/dist/typescript/clear-session-storage.d.ts.map +1 -0
- package/dist/typescript/clear-session-storage.js +25 -0
- package/dist/typescript/clear-session-storage.js.map +1 -0
- package/dist/typescript/clear.d.ts +3 -0
- package/dist/typescript/clear.d.ts.map +1 -0
- package/dist/typescript/clear.js +67 -0
- package/dist/typescript/clear.js.map +1 -0
- package/dist/typescript/click.d.ts +4 -0
- package/dist/typescript/click.d.ts.map +1 -0
- package/dist/typescript/click.js +52 -0
- package/dist/typescript/click.js.map +1 -0
- package/dist/typescript/core/accessibility/accname.d.ts +6 -0
- package/dist/typescript/core/accessibility/accname.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/accname.js +537 -0
- package/dist/typescript/core/accessibility/accname.js.map +1 -0
- package/dist/typescript/core/accessibility/context.d.ts +43 -0
- package/dist/typescript/core/accessibility/context.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/context.js +49 -0
- package/dist/typescript/core/accessibility/context.js.map +1 -0
- package/dist/typescript/core/accessibility/hidden.d.ts +39 -0
- package/dist/typescript/core/accessibility/hidden.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/hidden.js +216 -0
- package/dist/typescript/core/accessibility/hidden.js.map +1 -0
- package/dist/typescript/core/accessibility/roles.d.ts +28 -0
- package/dist/typescript/core/accessibility/roles.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/roles.js +381 -0
- package/dist/typescript/core/accessibility/roles.js.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts +13 -0
- package/dist/typescript/core/accessibility/snapshot.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/snapshot.js +55 -0
- package/dist/typescript/core/accessibility/snapshot.js.map +1 -0
- package/dist/typescript/core/accessibility/states.d.ts +18 -0
- package/dist/typescript/core/accessibility/states.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/states.js +215 -0
- package/dist/typescript/core/accessibility/states.js.map +1 -0
- package/dist/typescript/core/accessibility/tree.d.ts +10 -0
- package/dist/typescript/core/accessibility/tree.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/tree.js +261 -0
- package/dist/typescript/core/accessibility/tree.js.map +1 -0
- package/dist/typescript/core/accessibility/types.d.ts +30 -0
- package/dist/typescript/core/accessibility/types.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/types.js +18 -0
- package/dist/typescript/core/accessibility/types.js.map +1 -0
- package/dist/typescript/core/accessibility/value.d.ts +4 -0
- package/dist/typescript/core/accessibility/value.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/value.js +83 -0
- package/dist/typescript/core/accessibility/value.js.map +1 -0
- package/dist/typescript/core/accessibility/wire.d.ts +57 -0
- package/dist/typescript/core/accessibility/wire.d.ts.map +1 -0
- package/dist/typescript/core/accessibility/wire.js +72 -0
- package/dist/typescript/core/accessibility/wire.js.map +1 -0
- package/dist/typescript/core/attribute.d.ts +3 -0
- package/dist/typescript/core/attribute.d.ts.map +1 -0
- package/dist/typescript/core/attribute.js +60 -0
- package/dist/typescript/core/attribute.js.map +1 -0
- package/dist/typescript/core/color.d.ts +2 -0
- package/dist/typescript/core/color.d.ts.map +1 -0
- package/dist/typescript/core/color.js +248 -0
- package/dist/typescript/core/color.js.map +1 -0
- package/dist/typescript/core/editable.d.ts +5 -0
- package/dist/typescript/core/editable.d.ts.map +1 -0
- package/dist/typescript/core/editable.js +55 -0
- package/dist/typescript/core/editable.js.map +1 -0
- package/dist/typescript/core/element.d.ts +6 -0
- package/dist/typescript/core/element.d.ts.map +1 -0
- package/dist/typescript/core/element.js +97 -0
- package/dist/typescript/core/element.js.map +1 -0
- package/dist/typescript/core/enabled.d.ts +2 -0
- package/dist/typescript/core/enabled.d.ts.map +1 -0
- package/dist/typescript/core/enabled.js +69 -0
- package/dist/typescript/core/enabled.js.map +1 -0
- package/dist/typescript/core/error.d.ts +13 -0
- package/dist/typescript/core/error.d.ts.map +1 -0
- package/dist/typescript/core/error.js +40 -0
- package/dist/typescript/core/error.js.map +1 -0
- package/dist/typescript/core/events.d.ts +91 -0
- package/dist/typescript/core/events.d.ts.map +1 -0
- package/dist/typescript/core/events.js +131 -0
- package/dist/typescript/core/events.js.map +1 -0
- package/dist/typescript/core/focus.d.ts +4 -0
- package/dist/typescript/core/focus.d.ts.map +1 -0
- package/dist/typescript/core/focus.js +88 -0
- package/dist/typescript/core/focus.js.map +1 -0
- package/dist/typescript/core/focusable.d.ts +2 -0
- package/dist/typescript/core/focusable.d.ts.map +1 -0
- package/dist/typescript/core/focusable.js +36 -0
- package/dist/typescript/core/focusable.js.map +1 -0
- package/dist/typescript/core/form.d.ts +2 -0
- package/dist/typescript/core/form.d.ts.map +1 -0
- package/dist/typescript/core/form.js +76 -0
- package/dist/typescript/core/form.js.map +1 -0
- package/dist/typescript/core/frame.d.ts +8 -0
- package/dist/typescript/core/frame.d.ts.map +1 -0
- package/dist/typescript/core/frame.js +95 -0
- package/dist/typescript/core/frame.js.map +1 -0
- package/dist/typescript/core/geometry.d.ts +28 -0
- package/dist/typescript/core/geometry.d.ts.map +1 -0
- package/dist/typescript/core/geometry.js +134 -0
- package/dist/typescript/core/geometry.js.map +1 -0
- package/dist/typescript/core/inject.d.ts +21 -0
- package/dist/typescript/core/inject.d.ts.map +1 -0
- package/dist/typescript/core/inject.js +282 -0
- package/dist/typescript/core/inject.js.map +1 -0
- package/dist/typescript/core/interactable.d.ts +2 -0
- package/dist/typescript/core/interactable.d.ts.map +1 -0
- package/dist/typescript/core/interactable.js +27 -0
- package/dist/typescript/core/interactable.js.map +1 -0
- package/dist/typescript/core/keyboard.d.ts +15 -0
- package/dist/typescript/core/keyboard.d.ts.map +1 -0
- package/dist/typescript/core/keyboard.js +356 -0
- package/dist/typescript/core/keyboard.js.map +1 -0
- package/dist/typescript/core/keys.d.ts +65 -0
- package/dist/typescript/core/keys.d.ts.map +1 -0
- package/dist/typescript/core/keys.js +125 -0
- package/dist/typescript/core/keys.js.map +1 -0
- package/dist/typescript/core/locators.d.ts +6 -0
- package/dist/typescript/core/locators.d.ts.map +1 -0
- package/dist/typescript/core/locators.js +610 -0
- package/dist/typescript/core/locators.js.map +1 -0
- package/dist/typescript/core/mouse.d.ts +17 -0
- package/dist/typescript/core/mouse.d.ts.map +1 -0
- package/dist/typescript/core/mouse.js +186 -0
- package/dist/typescript/core/mouse.js.map +1 -0
- package/dist/typescript/core/overflow.d.ts +5 -0
- package/dist/typescript/core/overflow.d.ts.map +1 -0
- package/dist/typescript/core/overflow.js +133 -0
- package/dist/typescript/core/overflow.js.map +1 -0
- package/dist/typescript/core/scroll.d.ts +3 -0
- package/dist/typescript/core/scroll.d.ts.map +1 -0
- package/dist/typescript/core/scroll.js +77 -0
- package/dist/typescript/core/scroll.js.map +1 -0
- package/dist/typescript/core/shown.d.ts +3 -0
- package/dist/typescript/core/shown.d.ts.map +1 -0
- package/dist/typescript/core/shown.js +190 -0
- package/dist/typescript/core/shown.js.map +1 -0
- package/dist/typescript/core/storage.d.ts +14 -0
- package/dist/typescript/core/storage.d.ts.map +1 -0
- package/dist/typescript/core/storage.js +98 -0
- package/dist/typescript/core/storage.js.map +1 -0
- package/dist/typescript/core/style.d.ts +2 -0
- package/dist/typescript/core/style.d.ts.map +1 -0
- package/dist/typescript/core/style.js +32 -0
- package/dist/typescript/core/style.js.map +1 -0
- package/dist/typescript/core/useragent.d.ts +3 -0
- package/dist/typescript/core/useragent.d.ts.map +1 -0
- package/dist/typescript/core/useragent.js +31 -0
- package/dist/typescript/core/useragent.js.map +1 -0
- package/dist/typescript/default-content.d.ts +2 -0
- package/dist/typescript/default-content.d.ts.map +1 -0
- package/dist/typescript/default-content.js +20 -0
- package/dist/typescript/default-content.js.map +1 -0
- package/dist/typescript/execute-async-script.d.ts +2 -0
- package/dist/typescript/execute-async-script.d.ts.map +1 -0
- package/dist/typescript/execute-async-script.js +20 -0
- package/dist/typescript/execute-async-script.js.map +1 -0
- package/dist/typescript/execute-script.d.ts +2 -0
- package/dist/typescript/execute-script.d.ts.map +1 -0
- package/dist/typescript/execute-script.js +20 -0
- package/dist/typescript/execute-script.js.map +1 -0
- package/dist/typescript/find-element-fragment.d.ts +8 -0
- package/dist/typescript/find-element-fragment.d.ts.map +1 -0
- package/dist/typescript/find-element-fragment.js +39 -0
- package/dist/typescript/find-element-fragment.js.map +1 -0
- package/dist/typescript/find-element.d.ts +2 -0
- package/dist/typescript/find-element.d.ts.map +1 -0
- package/dist/typescript/find-element.js +18 -0
- package/dist/typescript/find-element.js.map +1 -0
- package/dist/typescript/find-elements.d.ts +1 -2
- package/dist/typescript/find-elements.d.ts.map +1 -1
- package/dist/typescript/find-elements.js +1 -289
- package/dist/typescript/find-elements.js.map +1 -1
- package/dist/typescript/frame-by-id-or-name.d.ts +2 -0
- package/dist/typescript/frame-by-id-or-name.d.ts.map +1 -0
- package/dist/typescript/frame-by-id-or-name.js +22 -0
- package/dist/typescript/frame-by-id-or-name.js.map +1 -0
- package/dist/typescript/frame-by-index.d.ts +2 -0
- package/dist/typescript/frame-by-index.d.ts.map +1 -0
- package/dist/typescript/frame-by-index.js +19 -0
- package/dist/typescript/frame-by-index.js.map +1 -0
- package/dist/typescript/get-attribute-value.d.ts +2 -0
- package/dist/typescript/get-attribute-value.d.ts.map +1 -0
- package/dist/typescript/get-attribute-value.js +22 -0
- package/dist/typescript/get-attribute-value.js.map +1 -0
- package/dist/typescript/get-effective-style.d.ts +3 -0
- package/dist/typescript/get-effective-style.d.ts.map +1 -0
- package/dist/typescript/get-effective-style.js +84 -0
- package/dist/typescript/get-effective-style.js.map +1 -0
- package/dist/typescript/get-element-from-cache.d.ts +2 -0
- package/dist/typescript/get-element-from-cache.d.ts.map +1 -0
- package/dist/typescript/get-element-from-cache.js +20 -0
- package/dist/typescript/get-element-from-cache.js.map +1 -0
- package/dist/typescript/get-frame-window.d.ts +2 -0
- package/dist/typescript/get-frame-window.d.ts.map +1 -0
- package/dist/typescript/get-frame-window.js +22 -0
- package/dist/typescript/get-frame-window.js.map +1 -0
- package/dist/typescript/get-local-storage-item.d.ts +3 -0
- package/dist/typescript/get-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-item.js +25 -0
- package/dist/typescript/get-local-storage-item.js.map +1 -0
- package/dist/typescript/get-local-storage-key.d.ts +3 -0
- package/dist/typescript/get-local-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-key.js +26 -0
- package/dist/typescript/get-local-storage-key.js.map +1 -0
- package/dist/typescript/get-local-storage-keys.d.ts +3 -0
- package/dist/typescript/get-local-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-keys.js +25 -0
- package/dist/typescript/get-local-storage-keys.js.map +1 -0
- package/dist/typescript/get-local-storage-size.d.ts +3 -0
- package/dist/typescript/get-local-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-local-storage-size.js +25 -0
- package/dist/typescript/get-local-storage-size.js.map +1 -0
- package/dist/typescript/get-location.d.ts +9 -0
- package/dist/typescript/get-location.d.ts.map +1 -0
- package/dist/typescript/get-location.js +49 -0
- package/dist/typescript/get-location.js.map +1 -0
- package/dist/typescript/get-session-storage-item.d.ts +3 -0
- package/dist/typescript/get-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-item.js +25 -0
- package/dist/typescript/get-session-storage-item.js.map +1 -0
- package/dist/typescript/get-session-storage-key.d.ts +3 -0
- package/dist/typescript/get-session-storage-key.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-key.js +26 -0
- package/dist/typescript/get-session-storage-key.js.map +1 -0
- package/dist/typescript/get-session-storage-keys.d.ts +3 -0
- package/dist/typescript/get-session-storage-keys.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-keys.js +25 -0
- package/dist/typescript/get-session-storage-keys.js.map +1 -0
- package/dist/typescript/get-session-storage-size.d.ts +3 -0
- package/dist/typescript/get-session-storage-size.d.ts.map +1 -0
- package/dist/typescript/get-session-storage-size.js +25 -0
- package/dist/typescript/get-session-storage-size.js.map +1 -0
- package/dist/typescript/get-size.d.ts +7 -0
- package/dist/typescript/get-size.d.ts.map +1 -0
- package/dist/typescript/get-size.js +36 -0
- package/dist/typescript/get-size.js.map +1 -0
- package/dist/typescript/get-text.d.ts +3 -0
- package/dist/typescript/get-text.d.ts.map +1 -0
- package/dist/typescript/get-text.js +294 -0
- package/dist/typescript/get-text.js.map +1 -0
- package/dist/typescript/get-top-left-coordinates.d.ts +4 -0
- package/dist/typescript/get-top-left-coordinates.d.ts.map +1 -0
- package/dist/typescript/get-top-left-coordinates.js +36 -0
- package/dist/typescript/get-top-left-coordinates.js.map +1 -0
- package/dist/typescript/is-displayed.d.ts +1 -2
- package/dist/typescript/is-displayed.d.ts.map +1 -1
- package/dist/typescript/is-displayed.js +3 -396
- package/dist/typescript/is-displayed.js.map +1 -1
- package/dist/typescript/is-editable.d.ts +2 -0
- package/dist/typescript/is-editable.d.ts.map +1 -0
- package/dist/typescript/is-editable.js +18 -0
- package/dist/typescript/is-editable.js.map +1 -0
- package/dist/typescript/is-enabled.d.ts +2 -0
- package/dist/typescript/is-enabled.d.ts.map +1 -0
- package/dist/typescript/is-enabled.js +18 -0
- package/dist/typescript/is-enabled.js.map +1 -0
- package/dist/typescript/is-focusable.d.ts +2 -0
- package/dist/typescript/is-focusable.d.ts.map +1 -0
- package/dist/typescript/is-focusable.js +20 -0
- package/dist/typescript/is-focusable.js.map +1 -0
- package/dist/typescript/is-interactable.d.ts +2 -0
- package/dist/typescript/is-interactable.d.ts.map +1 -0
- package/dist/typescript/is-interactable.js +19 -0
- package/dist/typescript/is-interactable.js.map +1 -0
- package/dist/typescript/is-selected.d.ts +3 -0
- package/dist/typescript/is-selected.d.ts.map +1 -0
- package/dist/typescript/is-selected.js +29 -0
- package/dist/typescript/is-selected.js.map +1 -0
- package/dist/typescript/remove-local-storage-item.d.ts +3 -0
- package/dist/typescript/remove-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-local-storage-item.js +25 -0
- package/dist/typescript/remove-local-storage-item.js.map +1 -0
- package/dist/typescript/remove-session-storage-item.d.ts +3 -0
- package/dist/typescript/remove-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/remove-session-storage-item.js +25 -0
- package/dist/typescript/remove-session-storage-item.js.map +1 -0
- package/dist/typescript/set-local-storage-item.d.ts +3 -0
- package/dist/typescript/set-local-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-local-storage-item.js +26 -0
- package/dist/typescript/set-local-storage-item.js.map +1 -0
- package/dist/typescript/set-session-storage-item.d.ts +3 -0
- package/dist/typescript/set-session-storage-item.d.ts.map +1 -0
- package/dist/typescript/set-session-storage-item.js +26 -0
- package/dist/typescript/set-session-storage-item.js.map +1 -0
- package/dist/typescript/submit.d.ts +3 -0
- package/dist/typescript/submit.d.ts.map +1 -0
- package/dist/typescript/submit.js +50 -0
- package/dist/typescript/submit.js.map +1 -0
- package/dist/typescript/type.d.ts +3 -0
- package/dist/typescript/type.d.ts.map +1 -0
- package/dist/typescript/type.js +201 -0
- package/dist/typescript/type.js.map +1 -0
- package/index.ts +44 -0
- package/package.json +306 -5
- package/typescript/accessibility-snapshot-wire.ts +20 -0
- package/typescript/accessibility-snapshot.ts +21 -0
- package/typescript/active-element.ts +19 -0
- package/typescript/clear-local-storage.ts +27 -0
- package/typescript/clear-session-storage.ts +27 -0
- package/typescript/clear.ts +73 -0
- package/typescript/click.ts +55 -0
- package/typescript/core/accessibility/accname.ts +587 -0
- package/typescript/core/accessibility/context.ts +116 -0
- package/typescript/core/accessibility/hidden.ts +242 -0
- package/typescript/core/accessibility/roles.ts +410 -0
- package/typescript/core/accessibility/snapshot.ts +61 -0
- package/typescript/core/accessibility/states.ts +233 -0
- package/typescript/core/accessibility/tree.ts +306 -0
- package/typescript/core/accessibility/types.ts +52 -0
- package/typescript/core/accessibility/value.ts +89 -0
- package/typescript/core/accessibility/wire.ts +123 -0
- package/typescript/core/attribute.ts +68 -0
- package/typescript/core/color.ts +257 -0
- package/typescript/core/editable.ts +63 -0
- package/typescript/core/element.ts +110 -0
- package/typescript/core/enabled.ts +76 -0
- package/typescript/core/error.ts +41 -0
- package/typescript/core/events.ts +268 -0
- package/typescript/core/focus.ts +92 -0
- package/typescript/core/focusable.ts +38 -0
- package/typescript/core/form.ts +81 -0
- package/typescript/core/frame.ts +105 -0
- package/typescript/core/geometry.ts +183 -0
- package/typescript/core/inject.ts +336 -0
- package/typescript/core/interactable.ts +30 -0
- package/typescript/core/keyboard.ts +369 -0
- package/typescript/core/keys.ts +204 -0
- package/typescript/core/locators.ts +704 -0
- package/typescript/core/mouse.ts +211 -0
- package/typescript/core/overflow.ts +172 -0
- package/typescript/core/scroll.ts +92 -0
- package/typescript/core/shown.ts +233 -0
- package/typescript/core/storage.ts +111 -0
- package/typescript/core/style.ts +32 -0
- package/typescript/core/useragent.ts +33 -0
- package/typescript/default-content.ts +20 -0
- package/typescript/execute-async-script.ts +20 -0
- package/typescript/execute-script.ts +20 -0
- package/typescript/find-element-fragment.ts +45 -0
- package/typescript/find-element.ts +18 -0
- package/typescript/find-elements.ts +1 -326
- package/typescript/frame-by-id-or-name.ts +22 -0
- package/typescript/frame-by-index.ts +19 -0
- package/typescript/get-attribute-value.ts +22 -0
- package/typescript/get-effective-style.ts +93 -0
- package/typescript/get-element-from-cache.ts +20 -0
- package/typescript/get-frame-window.ts +22 -0
- package/typescript/get-local-storage-item.ts +27 -0
- package/typescript/get-local-storage-key.ts +28 -0
- package/typescript/get-local-storage-keys.ts +27 -0
- package/typescript/get-local-storage-size.ts +27 -0
- package/typescript/get-location.ts +63 -0
- package/typescript/get-session-storage-item.ts +27 -0
- package/typescript/get-session-storage-key.ts +28 -0
- package/typescript/get-session-storage-keys.ts +27 -0
- package/typescript/get-session-storage-size.ts +27 -0
- package/typescript/get-size.ts +43 -0
- package/typescript/get-text.ts +353 -0
- package/typescript/get-top-left-coordinates.ts +38 -0
- package/typescript/is-displayed.ts +3 -498
- package/typescript/is-editable.ts +18 -0
- package/typescript/is-enabled.ts +18 -0
- package/typescript/is-focusable.ts +20 -0
- package/typescript/is-interactable.ts +19 -0
- package/typescript/is-selected.ts +31 -0
- package/typescript/remove-local-storage-item.ts +27 -0
- package/typescript/remove-session-storage-item.ts +27 -0
- package/typescript/set-local-storage-item.ts +28 -0
- package/typescript/set-session-storage-item.ts +28 -0
- package/typescript/submit.ts +53 -0
- package/typescript/type.ts +210 -0
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
import { JAVASCRIPT_ERROR, NO_SUCH_WINDOW, SCRIPT_TIMEOUT, STALE_ELEMENT_REFERENCE, UNKNOWN_ERROR, botError, } from './error.js';
|
|
18
|
+
// bot.inject: the element cache, the {ELEMENT}/{WINDOW} handle format and the
|
|
19
|
+
// {status, value} response envelope that injected scripts talk through.
|
|
20
|
+
//
|
|
21
|
+
// Statuses are W3C error strings, and success is 'success'. bot.inject sent
|
|
22
|
+
// bot.ErrorCode numbers (0, 10, 28...), the JSON wire protocol's encoding;
|
|
23
|
+
// a consumer that compared against those numbers has to compare strings now.
|
|
24
|
+
export const ELEMENT_KEY = 'ELEMENT';
|
|
25
|
+
export const WINDOW_KEY = 'WINDOW';
|
|
26
|
+
export const SUCCESS = 'success';
|
|
27
|
+
// Both live on the document rather than in module state because every atom is
|
|
28
|
+
// a separate bundle with its own module scope: the document is the only thing
|
|
29
|
+
// two injected atoms share. They must stay byte-identical to bot.inject.cache,
|
|
30
|
+
// or an id minted by a Closure atom is stale to a TypeScript one and the
|
|
31
|
+
// reverse, for as long as both kinds are injected into the same page.
|
|
32
|
+
const CACHE_KEY = '$wdc_';
|
|
33
|
+
const ELEMENT_KEY_PREFIX = ':wdc:';
|
|
34
|
+
function getCache(optDoc) {
|
|
35
|
+
const doc = (optDoc || document);
|
|
36
|
+
let cache = doc[CACHE_KEY];
|
|
37
|
+
if (!cache) {
|
|
38
|
+
// The id counter lives in the cache so it resets whenever the cache does.
|
|
39
|
+
cache = doc[CACHE_KEY] = { nextId: Date.now() };
|
|
40
|
+
}
|
|
41
|
+
// The original notes nextId sometimes reads back as NaN; reseed rather than
|
|
42
|
+
// mint ':wdc:NaN'.
|
|
43
|
+
if (!cache.nextId) {
|
|
44
|
+
cache.nextId = Date.now();
|
|
45
|
+
}
|
|
46
|
+
return cache;
|
|
47
|
+
}
|
|
48
|
+
// Keyed by the owning document, so a window -- which has no ownerDocument --
|
|
49
|
+
// and a document both land in the current document's cache.
|
|
50
|
+
export function addElement(el) {
|
|
51
|
+
const cache = getCache(el.ownerDocument);
|
|
52
|
+
for (const key in cache) {
|
|
53
|
+
if (cache[key] == el) {
|
|
54
|
+
return key;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const id = ELEMENT_KEY_PREFIX + cache.nextId++;
|
|
58
|
+
cache[id] = el;
|
|
59
|
+
return id;
|
|
60
|
+
}
|
|
61
|
+
// Stale rather than no-such-element for an unknown key: the id may have come
|
|
62
|
+
// from a previous document's cache, which is gone after a navigation.
|
|
63
|
+
export function getElement(key, optDoc) {
|
|
64
|
+
key = decodeURIComponent(key);
|
|
65
|
+
const doc = optDoc || document;
|
|
66
|
+
const cache = getCache(doc);
|
|
67
|
+
// The cache also holds its own id counter, which is not a handle.
|
|
68
|
+
const el = cache[key];
|
|
69
|
+
if (typeof el !== 'object' || el === null) {
|
|
70
|
+
throw botError(STALE_ELEMENT_REFERENCE, 'Element does not exist in cache');
|
|
71
|
+
}
|
|
72
|
+
if ('setInterval' in el) {
|
|
73
|
+
if (el['closed']) {
|
|
74
|
+
delete cache[key];
|
|
75
|
+
throw botError(NO_SUCH_WINDOW, 'Window has been closed.');
|
|
76
|
+
}
|
|
77
|
+
return el;
|
|
78
|
+
}
|
|
79
|
+
// Attached means reachable from the documentElement, stepping out of shadow
|
|
80
|
+
// roots through their host.
|
|
81
|
+
let node = el;
|
|
82
|
+
while (node) {
|
|
83
|
+
if (node == doc.documentElement) {
|
|
84
|
+
return el;
|
|
85
|
+
}
|
|
86
|
+
if (node.host && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
|
87
|
+
node = node.host;
|
|
88
|
+
}
|
|
89
|
+
node = node.parentNode;
|
|
90
|
+
}
|
|
91
|
+
delete cache[key];
|
|
92
|
+
throw botError(STALE_ELEMENT_REFERENCE, 'Element is no longer attached to the DOM');
|
|
93
|
+
}
|
|
94
|
+
function isArrayLike(value) {
|
|
95
|
+
return typeof value.length == 'number';
|
|
96
|
+
}
|
|
97
|
+
// Makes a value JSON-safe: elements and documents become {ELEMENT: id},
|
|
98
|
+
// windows {WINDOW: id}, functions their source, undefined null, and other
|
|
99
|
+
// objects are walked keeping only string keys.
|
|
100
|
+
//
|
|
101
|
+
// `seen` is never popped, so an object reached twice through different paths
|
|
102
|
+
// -- not a cycle, just shared -- is reported as recursive too. Inherited from
|
|
103
|
+
// bot.inject.wrapValue; kept because it is what consumers get today.
|
|
104
|
+
export function wrapValue(value) {
|
|
105
|
+
const seen = [];
|
|
106
|
+
const wrap = (value) => {
|
|
107
|
+
switch (typeof value) {
|
|
108
|
+
case 'string':
|
|
109
|
+
case 'number':
|
|
110
|
+
case 'boolean':
|
|
111
|
+
return value;
|
|
112
|
+
case 'function':
|
|
113
|
+
return value.toString();
|
|
114
|
+
case 'object': {
|
|
115
|
+
if (value === null) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
// A real Array is mapped without joining `seen` -- goog.typeOf calls it
|
|
119
|
+
// 'array', not 'object' -- so the same array twice is not "recursive".
|
|
120
|
+
if (Array.isArray(value)) {
|
|
121
|
+
return value.map(wrap);
|
|
122
|
+
}
|
|
123
|
+
if (seen.indexOf(value) >= 0) {
|
|
124
|
+
throw botError(JAVASCRIPT_ERROR, 'Recursive object cannot be transferred');
|
|
125
|
+
}
|
|
126
|
+
// Duck-typed rather than instanceof, which is false for a node from
|
|
127
|
+
// another frame's realm.
|
|
128
|
+
const nodeType = value.nodeType;
|
|
129
|
+
if ('nodeType' in value && (nodeType == Node.ELEMENT_NODE || nodeType == Node.DOCUMENT_NODE)) {
|
|
130
|
+
return { [ELEMENT_KEY]: addElement(value) };
|
|
131
|
+
}
|
|
132
|
+
if ('document' in value) {
|
|
133
|
+
return { [WINDOW_KEY]: addElement(value) };
|
|
134
|
+
}
|
|
135
|
+
seen.push(value);
|
|
136
|
+
if (isArrayLike(value)) {
|
|
137
|
+
return Array.prototype.map.call(value, wrap);
|
|
138
|
+
}
|
|
139
|
+
const result = {};
|
|
140
|
+
for (const key in value) {
|
|
141
|
+
result[key] = wrap(value[key]);
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
default:
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
return wrap(value);
|
|
150
|
+
}
|
|
151
|
+
// Resolves {ELEMENT}/{WINDOW} handles against optDoc's cache. Functions pass
|
|
152
|
+
// through untouched so a script can be handed a callback.
|
|
153
|
+
export function unwrapValue(value, optDoc) {
|
|
154
|
+
if (Array.isArray(value)) {
|
|
155
|
+
return value.map((v) => unwrapValue(v, optDoc));
|
|
156
|
+
}
|
|
157
|
+
if (typeof value == 'function') {
|
|
158
|
+
return value;
|
|
159
|
+
}
|
|
160
|
+
if (value !== null && typeof value == 'object') {
|
|
161
|
+
const obj = value;
|
|
162
|
+
if (ELEMENT_KEY in obj) {
|
|
163
|
+
return getElement(obj[ELEMENT_KEY], optDoc);
|
|
164
|
+
}
|
|
165
|
+
if (WINDOW_KEY in obj) {
|
|
166
|
+
return getElement(obj[WINDOW_KEY], optDoc);
|
|
167
|
+
}
|
|
168
|
+
const result = {};
|
|
169
|
+
for (const key in obj) {
|
|
170
|
+
result[key] = unwrapValue(obj[key], optDoc);
|
|
171
|
+
}
|
|
172
|
+
return result;
|
|
173
|
+
}
|
|
174
|
+
return value;
|
|
175
|
+
}
|
|
176
|
+
export function wrapResponse(value) {
|
|
177
|
+
return { status: SUCCESS, value: wrapValue(value) };
|
|
178
|
+
}
|
|
179
|
+
// Only a string code is a status. A DOMException carries a legacy numeric
|
|
180
|
+
// `code` (12 for a bad selector), which would otherwise leak through as one.
|
|
181
|
+
export function wrapError(err) {
|
|
182
|
+
const code = err === null || err === void 0 ? void 0 : err.code;
|
|
183
|
+
return {
|
|
184
|
+
status: typeof code == 'string' ? code : UNKNOWN_ERROR,
|
|
185
|
+
value: { message: err === null || err === void 0 ? void 0 : err.message },
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
// Compiles `fn` in the target window's realm so that globals it names resolve
|
|
189
|
+
// there. A string is a function body; a function is recompiled from its
|
|
190
|
+
// source, which assumes it closes over nothing outside that window.
|
|
191
|
+
function recompileFunction(fn, theWindow) {
|
|
192
|
+
const WindowFunction = theWindow.Function;
|
|
193
|
+
if (typeof fn === 'string') {
|
|
194
|
+
return new WindowFunction(fn);
|
|
195
|
+
}
|
|
196
|
+
return theWindow == window ? fn : new WindowFunction('return (' + fn + ').apply(null,arguments);');
|
|
197
|
+
}
|
|
198
|
+
export function executeScript(fn, args, optStringify, optWindow) {
|
|
199
|
+
const win = optWindow || window;
|
|
200
|
+
let ret;
|
|
201
|
+
try {
|
|
202
|
+
const compiled = recompileFunction(fn, win);
|
|
203
|
+
const unwrappedArgs = unwrapValue(args, win.document);
|
|
204
|
+
ret = wrapResponse(compiled.apply(null, unwrappedArgs));
|
|
205
|
+
}
|
|
206
|
+
catch (ex) {
|
|
207
|
+
ret = wrapError(ex);
|
|
208
|
+
}
|
|
209
|
+
return optStringify ? JSON.stringify(ret) : ret;
|
|
210
|
+
}
|
|
211
|
+
// The script finishes by calling the callback appended as its last argument.
|
|
212
|
+
// onDone is always called exactly once: with that value, with the error the
|
|
213
|
+
// script threw, on timeout, or when the window unloads underneath it.
|
|
214
|
+
export function executeAsyncScript(fn, args, timeout, onDone, optStringify, optWindow) {
|
|
215
|
+
const win = optWindow || window;
|
|
216
|
+
let timeoutId;
|
|
217
|
+
let responseSent = false;
|
|
218
|
+
function onunload() {
|
|
219
|
+
sendResponse(UNKNOWN_ERROR, Error('Detected a page unload event; asynchronous script execution does not work across page loads.'));
|
|
220
|
+
}
|
|
221
|
+
function sendResponse(status, value) {
|
|
222
|
+
if (responseSent) {
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
// Marked before delivery, so an onDone that throws cannot be followed by
|
|
226
|
+
// the timeout or the unload handler delivering a second response.
|
|
227
|
+
responseSent = true;
|
|
228
|
+
win.removeEventListener('unload', onunload, true);
|
|
229
|
+
win.clearTimeout(timeoutId);
|
|
230
|
+
let response;
|
|
231
|
+
if (status != SUCCESS) {
|
|
232
|
+
const cause = value;
|
|
233
|
+
const err = botError(status, cause.message || value + '');
|
|
234
|
+
err.stack = cause.stack;
|
|
235
|
+
response = wrapError(err);
|
|
236
|
+
}
|
|
237
|
+
else {
|
|
238
|
+
// A value that cannot be transferred, such as a cyclic object, is the
|
|
239
|
+
// script's error to report, not an exception thrown back into it.
|
|
240
|
+
try {
|
|
241
|
+
response = wrapResponse(value);
|
|
242
|
+
}
|
|
243
|
+
catch (e) {
|
|
244
|
+
response = wrapError(e);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
onDone(optStringify ? JSON.stringify(response) : response);
|
|
248
|
+
}
|
|
249
|
+
if (win.closed) {
|
|
250
|
+
sendResponse(UNKNOWN_ERROR, 'Unable to execute script; the target window is closed.');
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
win.addEventListener('unload', onunload, true);
|
|
254
|
+
const startTime = Date.now();
|
|
255
|
+
// Compiling and unwrapping sit inside the try, as they do in executeScript,
|
|
256
|
+
// so a syntax error or a stale element argument reaches onDone with its own
|
|
257
|
+
// status. bot.inject threw those out of the atom instead.
|
|
258
|
+
try {
|
|
259
|
+
const compiled = recompileFunction(fn, win);
|
|
260
|
+
const unwrappedArgs = unwrapValue(args, win.document);
|
|
261
|
+
unwrappedArgs.push((value) => sendResponse(SUCCESS, value));
|
|
262
|
+
compiled.apply(win, unwrappedArgs);
|
|
263
|
+
// Armed after the call, so a script that calls back from a zero-length
|
|
264
|
+
// timer is not beaten to it by its own timeout -- and not at all if it
|
|
265
|
+
// already called back, or the timer would outlive the call for nothing.
|
|
266
|
+
if (!responseSent) {
|
|
267
|
+
timeoutId = win.setTimeout(() => {
|
|
268
|
+
sendResponse(SCRIPT_TIMEOUT, Error('Timed out waiting for asynchronous script result after ' + (Date.now() - startTime) + ' ms'));
|
|
269
|
+
}, Math.max(0, timeout));
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
catch (ex) {
|
|
273
|
+
const code = ex.code;
|
|
274
|
+
sendResponse(typeof code == 'string' ? code : UNKNOWN_ERROR, ex);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
// webdriver.atoms.inject.getWindow: the window named by a {WINDOW: id} handle,
|
|
278
|
+
// or the current one.
|
|
279
|
+
export function getWindow(optWindow) {
|
|
280
|
+
return optWindow ? getElement(optWindow[WINDOW_KEY]) : window;
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=inject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject.js","sourceRoot":"","sources":["../../../typescript/core/inject.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;AAErB,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,aAAa,EACb,QAAQ,GACT,MAAM,YAAY,CAAA;AAEnB,8EAA8E;AAC9E,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,2EAA2E;AAC3E,6EAA6E;AAE7E,MAAM,CAAC,MAAM,WAAW,GAAG,SAAS,CAAA;AACpC,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAA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pE,QAAQ,CAAC,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,CAAA;QAElC,uEAAuE;QACvE,uEAAuE;QACvE,wEAAwE;QACxE,IAAI,CAAC,YAAY,EAAE,CAAC;YAClB,SAAS,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,EAAE;gBAC9B,YAAY,CACV,cAAc,EACd,KAAK,CAAC,yDAAyD,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,CACpG,CAAA;YACH,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAA;QAC1B,CAAC;IACH,CAAC;IAAC,OAAO,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAI,EAAyB,CAAC,IAAI,CAAA;QAC5C,YAAY,CAAC,OAAO,IAAI,IAAI,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,EAAE,EAAE,CAAC,CAAA;IAClE,CAAC;AACH,CAAC;AAED,+EAA+E;AAC/E,sBAAsB;AACtB,MAAM,UAAU,SAAS,CAAC,SAAoC;IAC5D,OAAO,SAAS,CAAC,CAAC,CAAE,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,CAAY,CAAC,CAAC,CAAC,MAAM,CAAA;AAC3E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactable.d.ts","sourceRoot":"","sources":["../../../typescript/core/interactable.ts"],"names":[],"mappings":"AAuBA,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAMxD"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
import { isEnabled } from './enabled.js';
|
|
18
|
+
import isShown from './shown.js';
|
|
19
|
+
import { getEffectiveStyle } from './style.js';
|
|
20
|
+
// Opacity is ignored deliberately: a fully transparent control still takes
|
|
21
|
+
// clicks, so it is interactable even though it is not displayed.
|
|
22
|
+
export function isInteractable(element) {
|
|
23
|
+
return (isShown(element, /* optIgnoreOpacity= */ true) &&
|
|
24
|
+
isEnabled(element) &&
|
|
25
|
+
getEffectiveStyle(element, 'pointer-events') !== 'none');
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=interactable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interactable.js","sourceRoot":"","sources":["../../../typescript/core/interactable.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;AAErB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,OAAO,MAAM,YAAY,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAE9C,2EAA2E;AAC3E,iEAAiE;AACjE,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC7C,OAAO,CACL,OAAO,CAAC,OAAO,EAAE,uBAAuB,CAAC,IAAI,CAAC;QAC9C,SAAS,CAAC,OAAO,CAAC;QAClB,iBAAiB,CAAC,OAAO,EAAE,gBAAgB,CAAC,KAAK,MAAM,CACxD,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type Key } from './keys.js';
|
|
2
|
+
export declare class Keyboard {
|
|
3
|
+
private element;
|
|
4
|
+
private readonly pressed;
|
|
5
|
+
isPressed(key: Key): boolean;
|
|
6
|
+
moveCursor(element: Element): void;
|
|
7
|
+
pressKey(key: Key): void;
|
|
8
|
+
releaseKey(key: Key): void;
|
|
9
|
+
releaseModifiers(): void;
|
|
10
|
+
private target;
|
|
11
|
+
private typed;
|
|
12
|
+
private fireKey;
|
|
13
|
+
private edit;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../../typescript/core/keyboard.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,KAAK,GAAG,EAAgC,MAAM,WAAW,CAAA;AAsBlE,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiB;IAEzC,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,OAAO;IAQ5B,UAAU,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAOlC,QAAQ,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAyBxB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI;IAS1B,gBAAgB,IAAI,IAAI;IAUxB,OAAO,CAAC,MAAM;IAMd,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,OAAO;IA2Bf,OAAO,CAAC,IAAI;CAsBb"}
|