You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewError('fillField: rich editor target did not accept focus. Locator must point at the visible editor surface (a wrapper, iframe, or contenteditable) — not a hidden backing element.')
125
+
}
126
+
}
127
+
79
128
asyncfunctionfindMarked(helper){
80
129
constroot=helper.page||helper.browser
81
130
constraw=awaitroot.$('['+MARKER+']')
@@ -91,22 +140,36 @@ export async function fillRichEditor(helper, el, value) {
91
140
constsource=elinstanceofWebElement ? el : newWebElement(el,helper)
thrownewError('fillField: cannot fill a display:none form control. Locator must point at the visible editor surface (a wrapper, iframe, or contenteditable).')
`.//*[@role='tab' or @role='link' or @role='menuitem' or @role='menuitemcheckbox' or @role='menuitemradio' or @role='option' or @role='treeitem'][contains(normalize-space(string(.)), ${literal})]`,
594
595
]),
595
596
596
597
/**
597
598
* @param {string} literal
598
599
* @returns {string}
599
600
*/
600
-
self: literal=>`./self::*[contains(normalize-space(string(.)), ${literal}) or contains(normalize-space(@value), ${literal})]`,
601
+
self: literal=>{
602
+
// Narrowest-match: prefer the deepest descendant whose string-value contains the literal.
603
+
// Falling back to `self` without the `not(descendant...)` guard would match a container
604
+
// whose concatenated text happens to include the literal (e.g. a <ul role="tablist"> whose
605
+
// tab labels all sit in its string-value) and click the container itself.
606
+
constnarrowest=`contains(normalize-space(string(.)), ${literal}) and not(.//*[contains(normalize-space(string(.)), ${literal})])`
607
+
returnxpathLocator.combine([
608
+
`.//*[${narrowest}]`,
609
+
`./self::*[${narrowest} or contains(normalize-space(@value), ${literal})]`,
0 commit comments