Exemple #1
0
 //<input aria-label="target">
 //*[(self::a or self::button or @role='button' or @role='link' or @role='menuitem' or self::input or self::textarea or self::select) and @aria-label='{target}']
 virtual protected Func <string, IEnumerable <SelectorPrefix>, IWebDriver, IEnumerable <Element> > ByNested(string elementType) =>
 (target, prefixes, driver) => Permutate(prefixes, driver, (prefix) =>
                                         $"{prefix}//*[{elementType} and (" +
                                         $"{XpathProvider.TextMatch(target)} or " +
                                         $"label[{XpathProvider.TextMatch(target)}] or " +
                                         $"((@type='button' or @type='submit' or @type='reset') and @value={target.XpathEncode()}) or " +
                                         $"@name={target.XpathEncode()} or " +
                                         $"@aria-label={target.XpathEncode()} or " +
                                         $"@placeholder={target.XpathEncode()} or " +
                                         $"(@type='radio' and @value={target.XpathEncode()})" +
                                         $")]");
Exemple #2
0
 //<a href = "https://www.w3schools.com/html/" >target</a>
 //*[(self::a or self::button or @role='button' or @role='link' or @role='menuitem') and text()='{target}']
 virtual protected Func <string, IEnumerable <SelectorPrefix>, IWebDriver, IEnumerable <Element> > ByText(string elementType) =>
 (target, prefixes, driver) => Permutate(prefixes, driver, (prefix) =>
                                         $"{prefix}//*[{elementType} and {XpathProvider.TextMatch(target)}]");
Exemple #3
0
 //<label><span><strong>target</strong></span><input type = "text" ></ label >
 //*[text()='{target}']/ancestor::label//*[self::input or self::textarea or self::select]
 virtual protected Func <string, IEnumerable <SelectorPrefix>, IWebDriver, IEnumerable <Element> > ByLabelAncestor(string elementType) =>
 (target, prefixes, driver) => Permutate(prefixes, driver, (prefix) =>
                                         $"{prefix}//*[{XpathProvider.MarkerElements} and {XpathProvider.TextMatch(target)}]/ancestor::label//*[{elementType}]");
Exemple #4
0
 //label[text()[normalize-space(.)='Bob']]/*[self::input]
 //<label>target<input type = "text" ></ label >
 //label[text()='{target}']/*[self::input or self::textarea or self::select]
 virtual protected Func <string, IEnumerable <SelectorPrefix>, IWebDriver, IEnumerable <Element> > ByNestedInLabel(string elementType) =>
 (target, prefixes, driver) => Permutate(prefixes, driver, (prefix) =>
                                         $"{prefix}//*[(self::label or self::div) and {XpathProvider.TextMatch(target)}]/*[{elementType}]");