Skip to content

Commit e25f510

Browse files
Extend locateNodes with a locator to get navigable's container element (#811)
* Add a way to find navigable's container * Fix build by referencing css22 instead of css2 (#816) * address review comments * Update index.bs Co-authored-by: Maksim Sadym <[email protected]> --------- Co-authored-by: Maksim Sadym <[email protected]>
1 parent afcde7f commit e25f510

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

index.bs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3075,6 +3075,7 @@ To <dfn>await a navigation</dfn> given |navigable|, |request|, |wait condition|,
30753075
browsingContext.Locator = (
30763076
browsingContext.AccessibilityLocator /
30773077
browsingContext.CssLocator /
3078+
browsingContext.ContextLocator /
30783079
browsingContext.InnerTextLocator /
30793080
browsingContext.XPathLocator
30803081
)
@@ -3092,6 +3093,13 @@ browsingContext.CssLocator = {
30923093
value: text
30933094
}
30943095

3096+
browsingContext.ContextLocator = {
3097+
type: "context",
3098+
value: {
3099+
context: browsingContext.BrowsingContext,
3100+
}
3101+
}
3102+
30953103
browsingContext.InnerTextLocator = {
30963104
type: "innerText",
30973105
value: text,
@@ -3891,6 +3899,18 @@ To <dfn>locate nodes using CSS</dfn> with given |navigable|, |context nodes|,
38913899

38923900
</div>
38933901

3902+
<div algorithm="locate the container element">
3903+
To <dfn>locate the container element</dfn> given |navigable|:
3904+
3905+
1. Let |returned nodes| be an empty [=/list=].
3906+
3907+
1. If |navigable|'s [=navigable/container=] is not null,
3908+
append |navigable|'s [=navigable/container=] to |returned nodes|.
3909+
3910+
1. Return |returned nodes|.
3911+
3912+
</div>
3913+
38943914
<div algorithm="locate nodes using XPath">
38953915

38963916
To <dfn>locate nodes using XPath</dfn> with given |navigable|, |context nodes|,
@@ -4158,6 +4178,25 @@ The [=remote end steps=] with |session| and |command parameters| are:
41584178
1. Let |result nodes| be [=locate nodes using accessibility attributes=]
41594179
given |context nodes|, |selector|, and |maximum returned node count|.
41604180

4181+
<dt>|type| is the string "<code>context</code>"
4182+
<dd>
4183+
4184+
1. If |start nodes parameter| is not null,
4185+
return [=error=] with [=error code=] "<code>invalid argument</code>".
4186+
4187+
1. Let |selector| be |locator|["<code>value</code>"].
4188+
4189+
1. Let |context id| be |selector|["<code>context</code>"].
4190+
4191+
1. Let |child navigable| be the result of [=trying=] to [=get a navigable=] with |context id|.
4192+
4193+
1. If |child navigable|'s [=navigable/parent=] is not |navigable|,
4194+
return [=error=] with [=error code=] "<code>invalid argument</code>".
4195+
4196+
1. Let |result nodes| be [=locate the container element=] given |child navigable|.
4197+
4198+
1. Assert: For each |node| in |result nodes|, |node|'s [=/node navigable=] is |navigable|.
4199+
41614200
1. Assert: |maximum returned node count| is null or [=list/size=] of |result nodes| is less
41624201
than or equal to |maximum returned node count|.
41634202

0 commit comments

Comments
 (0)