@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,233 @@
|
|
|
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
|
+
|
|
18
|
+
import { getParentElement, getParentNodeInComposedDom, isElement } from './element.js'
|
|
19
|
+
import {
|
|
20
|
+
ImageMapResult,
|
|
21
|
+
Rect,
|
|
22
|
+
getClientRect as readClientRect,
|
|
23
|
+
getClientRegion as readClientRegion,
|
|
24
|
+
maybeFindImageMap as findImageMap,
|
|
25
|
+
} from './geometry.js'
|
|
26
|
+
import { OverflowState, getOverflowState as readOverflowState } from './overflow.js'
|
|
27
|
+
|
|
28
|
+
function isShownElement(elem: Element, optIgnoreOpacity?: boolean): boolean {
|
|
29
|
+
// Per-call memoisation caches. Scoped here so they live only for the
|
|
30
|
+
// duration of this synchronous call — no stale-data risk, no GC pressure
|
|
31
|
+
// between invocations. The helpers that read them stay in this scope for
|
|
32
|
+
// the same reason; only the cache-free primitives moved to core/.
|
|
33
|
+
var computedStyleCache = new Map<Element, CSSStyleDeclaration | null>();
|
|
34
|
+
var clientRectCache = new Map<Element, Rect>();
|
|
35
|
+
var displayedCache = new Map<Node, boolean>();
|
|
36
|
+
|
|
37
|
+
function getEffectiveStyle(elem: Element, propertyName: string): string | null {
|
|
38
|
+
var computed = computedStyleCache.get(elem);
|
|
39
|
+
if (computed === undefined) {
|
|
40
|
+
var win = elem.ownerDocument.defaultView;
|
|
41
|
+
computed = win ? (win.getComputedStyle(elem) || null) : null;
|
|
42
|
+
computedStyleCache.set(elem, computed);
|
|
43
|
+
}
|
|
44
|
+
if (!computed) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
var value = computed.getPropertyValue(propertyName);
|
|
48
|
+
return value || null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function getOpacity(elem: Element): number {
|
|
52
|
+
var opacityStyle = getEffectiveStyle(elem, 'opacity');
|
|
53
|
+
var opacity = opacityStyle ? Number(opacityStyle) : 1;
|
|
54
|
+
var parent = getParentElement(elem);
|
|
55
|
+
return parent ? opacity * getOpacity(parent) : opacity;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Memoising delegates over the shared geometry primitives. One isDisplayed
|
|
59
|
+
// call reads the same element's rect many times over, so the cache is what
|
|
60
|
+
// keeps that from forcing a reflow each time; the uncached primitives live
|
|
61
|
+
// in core/geometry.ts for every other caller.
|
|
62
|
+
function getClientRect(elem: Element): Rect {
|
|
63
|
+
var cachedRect = clientRectCache.get(elem);
|
|
64
|
+
if (cachedRect) {
|
|
65
|
+
return cachedRect;
|
|
66
|
+
}
|
|
67
|
+
var rect = readClientRect(elem, getClientRect);
|
|
68
|
+
clientRectCache.set(elem, rect);
|
|
69
|
+
return rect;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function maybeFindImageMap(elem: Element): ImageMapResult | null {
|
|
73
|
+
return findImageMap(elem, getClientRect);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function getClientRegion(elem: Element): Rect {
|
|
77
|
+
return readClientRegion(elem, undefined, getClientRect);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// The memoised readers are threaded through so the overflow walk shares this
|
|
81
|
+
// call's caches; isDisplayed asks about the whole element, never a region.
|
|
82
|
+
function getOverflowState(elem: Element): OverflowState {
|
|
83
|
+
return readOverflowState(elem, undefined, getEffectiveStyle, getClientRect);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function isShownInternal(elem: Element, ignoreOpacity: boolean, displayedFn: (element: Node) => boolean): boolean {
|
|
87
|
+
if (!isElement(elem)) {
|
|
88
|
+
throw new Error('Argument to isShown must be of type Element');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (isElement(elem, 'BODY')) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (isElement(elem, 'OPTION') || isElement(elem, 'OPTGROUP')) {
|
|
96
|
+
var select = (elem as Element).closest('select');
|
|
97
|
+
return !!select && isShownInternal(select, true, displayedFn);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
var imageMap = maybeFindImageMap(elem);
|
|
101
|
+
if (imageMap) {
|
|
102
|
+
return !!imageMap.image && imageMap.rect.width > 0 && imageMap.rect.height > 0 &&
|
|
103
|
+
isShownInternal(imageMap.image, ignoreOpacity, displayedFn);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (isElement(elem, 'INPUT') && (elem as HTMLInputElement).type.toLowerCase() === 'hidden') {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (isElement(elem, 'NOSCRIPT')) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
var visibility = getEffectiveStyle(elem, 'visibility');
|
|
115
|
+
if (visibility === 'collapse' || visibility === 'hidden') {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (!displayedFn(elem)) {
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (!ignoreOpacity && getOpacity(elem) === 0) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function positiveSize(element: Element): boolean {
|
|
128
|
+
var rect = getClientRect(element);
|
|
129
|
+
if (rect.height > 0 && rect.width > 0) {
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (isElement(element, 'PATH') && (rect.height > 0 || rect.width > 0)) {
|
|
134
|
+
var strokeWidth = getEffectiveStyle(element, 'stroke-width');
|
|
135
|
+
return !!strokeWidth && parseInt(strokeWidth, 10) > 0;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var elementVisibility = getEffectiveStyle(element, 'visibility');
|
|
139
|
+
if (elementVisibility === 'collapse' || elementVisibility === 'hidden') {
|
|
140
|
+
return false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
if (!displayedFn(element)) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (getEffectiveStyle(element, 'overflow') === 'hidden') {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
for (var index = 0; index < element.childNodes.length; index += 1) {
|
|
152
|
+
var child = element.childNodes[index];
|
|
153
|
+
if (child.nodeType === Node.TEXT_NODE) {
|
|
154
|
+
var text = child.nodeValue || '';
|
|
155
|
+
if (/^[\s]*$/.test(text) && /[\n\r\t]/.test(text)) {
|
|
156
|
+
continue;
|
|
157
|
+
}
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
if (isElement(child) && positiveSize(child)) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (!positiveSize(elem)) {
|
|
170
|
+
return false;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function hiddenByOverflow(element: Element): boolean {
|
|
174
|
+
if (getOverflowState(element) !== 'hidden') {
|
|
175
|
+
return false;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
for (var index = 0; index < element.childNodes.length; index += 1) {
|
|
179
|
+
var child = element.childNodes[index];
|
|
180
|
+
if (isElement(child) && !hiddenByOverflow(child) && positiveSize(child)) {
|
|
181
|
+
return false;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return !hiddenByOverflow(elem);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
function displayed(node: Node): boolean {
|
|
192
|
+
var cached = displayedCache.get(node);
|
|
193
|
+
if (cached !== undefined) {
|
|
194
|
+
return cached;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
if (isElement(node)) {
|
|
198
|
+
var display = getEffectiveStyle(node, 'display');
|
|
199
|
+
var contentVisibility = getEffectiveStyle(node, 'content-visibility');
|
|
200
|
+
if (display === 'none' || contentVisibility === 'hidden') {
|
|
201
|
+
displayedCache.set(node, false);
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
var parent = getParentNodeInComposedDom(node);
|
|
207
|
+
if (typeof ShadowRoot === 'function' && parent instanceof ShadowRoot) {
|
|
208
|
+
if (parent.host.shadowRoot && parent.host.shadowRoot !== parent) {
|
|
209
|
+
displayedCache.set(node, false);
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
parent = parent.host;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (parent && (parent.nodeType === Node.DOCUMENT_NODE || parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE)) {
|
|
216
|
+
displayedCache.set(node, true);
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (isElement(parent, 'DETAILS') && !(<HTMLDetailsElement>parent).open && !isElement(node, 'SUMMARY')) {
|
|
221
|
+
displayedCache.set(node, false);
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
var result = !!parent && displayed(parent);
|
|
226
|
+
displayedCache.set(node, result);
|
|
227
|
+
return result;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
return isShownInternal(elem, !!optIgnoreOpacity, displayed);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export default isShownElement;
|
|
@@ -0,0 +1,111 @@
|
|
|
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
|
+
|
|
18
|
+
import { UNKNOWN_ERROR, botError } from './error.js'
|
|
19
|
+
|
|
20
|
+
// A wrapper over one HTML5 web storage map, mirroring bot.storage.Storage.
|
|
21
|
+
//
|
|
22
|
+
// The return shapes here are the wire contract -- keySet gives a real Array,
|
|
23
|
+
// the single-value reads give string-or-null -- so consumers that parse the
|
|
24
|
+
// JSON these atoms send back keep working unchanged.
|
|
25
|
+
export class WebStorage {
|
|
26
|
+
private readonly storageMap: Storage
|
|
27
|
+
|
|
28
|
+
constructor(storageMap: Storage) {
|
|
29
|
+
this.storageMap = storageMap
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Values are coerced with `value + ''` before storing. Browsers disagreed
|
|
33
|
+
// about what a null value round-trips as -- Firefox reported <null>, Chrome
|
|
34
|
+
// the string "null" -- so bot.storage.Storage picked the string form and
|
|
35
|
+
// made every browser agree. Changing that would change what callers read
|
|
36
|
+
// back. (html5/storage.js:105)
|
|
37
|
+
setItem(key: string, value: unknown): void {
|
|
38
|
+
try {
|
|
39
|
+
this.storageMap.setItem(key, value + '')
|
|
40
|
+
} catch (error) {
|
|
41
|
+
// Typically a quota overrun, which surfaces as the storage atom failing
|
|
42
|
+
// rather than as a silent no-op.
|
|
43
|
+
throw botError(UNKNOWN_ERROR, (error as Error).message)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getItem(key: string): string | null {
|
|
48
|
+
return this.storageMap.getItem(key)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// An Array, not the live key list: Appium and the bindings parse this.
|
|
52
|
+
keySet(): string[] {
|
|
53
|
+
const keys: string[] = []
|
|
54
|
+
const length = this.size()
|
|
55
|
+
for (let i = 0; i < length; i++) {
|
|
56
|
+
keys[i] = this.storageMap.key(i) as string
|
|
57
|
+
}
|
|
58
|
+
return keys
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Returns the value that was removed, so callers get it without a separate
|
|
62
|
+
// read, or null when the key was not present.
|
|
63
|
+
removeItem(key: string): string | null {
|
|
64
|
+
const value = this.getItem(key)
|
|
65
|
+
this.storageMap.removeItem(key)
|
|
66
|
+
return value
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
clear(): void {
|
|
70
|
+
this.storageMap.clear()
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
size(): number {
|
|
74
|
+
return this.storageMap.length
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
key(index: number): string | null {
|
|
78
|
+
return this.storageMap.key(index)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Reading window.localStorage throws a SecurityError when the browser has
|
|
83
|
+
// blocked storage -- a third-party frame, or cookies turned off -- rather than
|
|
84
|
+
// returning null, which the original's plain null check predated. Both end up
|
|
85
|
+
// as the same "undefined" error either way.
|
|
86
|
+
function openStorage(win: Window, name: 'localStorage' | 'sessionStorage', message: string): WebStorage {
|
|
87
|
+
let storageMap: Storage | null = null
|
|
88
|
+
try {
|
|
89
|
+
storageMap = win[name]
|
|
90
|
+
} catch (_blocked) {
|
|
91
|
+
storageMap = null
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!storageMap) {
|
|
95
|
+
throw botError(UNKNOWN_ERROR, message)
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return new WebStorage(storageMap)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// The window defaults to the one the atom is running in. Closure went through
|
|
102
|
+
// bot.getWindow() because the inject layer retargets command execution at a
|
|
103
|
+
// frame; an atom called directly is already inside the frame it is asking
|
|
104
|
+
// about, and optWindow remains for callers that mean a different one.
|
|
105
|
+
export function getLocalStorage(optWindow?: Window): WebStorage {
|
|
106
|
+
return openStorage(optWindow || window, 'localStorage', 'Local storage undefined')
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function getSessionStorage(optWindow?: Window): WebStorage {
|
|
110
|
+
return openStorage(optWindow || window, 'sessionStorage', 'Session storage undefined')
|
|
111
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
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
|
+
|
|
18
|
+
// A single computed-style read. core/shown.ts has its own memoised copy of
|
|
19
|
+
// this because it reads hundreds of values per call; callers that want one
|
|
20
|
+
// property should use this one rather than paying for a cache they will throw
|
|
21
|
+
// away immediately.
|
|
22
|
+
//
|
|
23
|
+
// The cascaded-style fallback and colour standardisation from the Closure
|
|
24
|
+
// bot.dom.getEffectiveStyle belong to the get_effective_style atom, not here.
|
|
25
|
+
export function getEffectiveStyle(elem: Element, propertyName: string): string | null {
|
|
26
|
+
const win = elem.ownerDocument.defaultView
|
|
27
|
+
const computed = win ? win.getComputedStyle(elem) : null
|
|
28
|
+
if (!computed) {
|
|
29
|
+
return null
|
|
30
|
+
}
|
|
31
|
+
return computed.getPropertyValue(propertyName) || null
|
|
32
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
18
|
+
// The engine and platform splits the keyboard still needs: Firefox reports
|
|
19
|
+
// different keydown codes for a handful of keys, and a different Meta code on
|
|
20
|
+
// macOS. Every other branch in goog.userAgent was for Internet Explorer,
|
|
21
|
+
// EdgeHTML or long-gone engine versions.
|
|
22
|
+
|
|
23
|
+
// Firefox's UA carries "Gecko/<date>"; Blink and WebKit say "like Gecko" with
|
|
24
|
+
// no slash, and Firefox on iOS is WebKit underneath, so it correctly reads as
|
|
25
|
+
// not-Gecko here.
|
|
26
|
+
export function isGecko(win: Window = window): boolean {
|
|
27
|
+
return /\bGecko\//.test(win.navigator.userAgent)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// "Macintosh", not "Mac": iOS user agents say "like Mac OS X".
|
|
31
|
+
export function isMac(win: Window = window): boolean {
|
|
32
|
+
return /Macintosh/.test(win.navigator.userAgent)
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
18
|
+
// The top window of the frame tree, which is what "switch to default content"
|
|
19
|
+
// targets.
|
|
20
|
+
export { defaultContent as default } from './core/frame.js'
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
18
|
+
// bot.inject.executeAsyncScript: the script completes by calling the callback
|
|
19
|
+
// appended to its arguments; onDone receives the envelope exactly once.
|
|
20
|
+
export { executeAsyncScript as default } from './core/inject.js'
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
|
|
18
|
+
// bot.inject.executeScript: runs fn with handle-decoded args and returns the
|
|
19
|
+
// {status, value} envelope, as a JSON string when optStringify is set.
|
|
20
|
+
export { executeScript as default } from './core/inject.js'
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
|
|
18
|
+
import { ELEMENT_KEY, getElement, getWindow, wrapError, wrapResponse, type Response } from './core/inject.js'
|
|
19
|
+
import { findElement } from './core/locators.js'
|
|
20
|
+
|
|
21
|
+
// webdriver.atoms.inject.locators.findElement: find_element behind the inject
|
|
22
|
+
// layer. Takes the strategy and target as two strings and the root and window
|
|
23
|
+
// as wire handles, and answers with the JSON {status, value} envelope -- so
|
|
24
|
+
// unlike find_element it can be called with values that crossed the wire.
|
|
25
|
+
//
|
|
26
|
+
// The name is inherited: despite the suffix this is the wrapped atom, and
|
|
27
|
+
// find_element is the raw one.
|
|
28
|
+
function findElementFragment(
|
|
29
|
+
strategy: string,
|
|
30
|
+
using: string,
|
|
31
|
+
optRoot?: { [ELEMENT_KEY]: string },
|
|
32
|
+
optWindow?: { WINDOW: string },
|
|
33
|
+
): string {
|
|
34
|
+
let response: Response
|
|
35
|
+
try {
|
|
36
|
+
const targetWindow = getWindow(optWindow)
|
|
37
|
+
const root = optRoot ? (getElement(optRoot[ELEMENT_KEY], targetWindow.document) as Element) : targetWindow.document
|
|
38
|
+
response = wrapResponse(findElement({ [strategy]: using }, root))
|
|
39
|
+
} catch (ex) {
|
|
40
|
+
response = wrapError(ex)
|
|
41
|
+
}
|
|
42
|
+
return JSON.stringify(response)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export default findElementFragment
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
|
|
18
|
+
export { findElement as default } from './core/locators.js'
|