Element Location
How a Selenium client names the element it wants: the By strategies, what a find call hands back, the CSS and XPath expression languages, and reaching into a shadow root.
on this pageshowhide
explore
- Addressing Methods12 questions
- Standard Locator Types5 questions
- Find Result Semantics4 questions
- Nested and Scoped Search3 questions
- Query Expressions12 questions
- CSS Selector Limits4 questions
- XPath Axes and Predicates4 questions
- Selector Cost Trade-Offs4 questions
- Structural Lookups8 questions
- Proximity Filters4 questions
- Shadow Root Access4 questions
questions
page 2 of 2In Selenium XPath locators, why is ends-with() unavailable when starts-with() works fine?
level: middleimportance: nice to knowfreq 28%
basics
~10 sBrowsers evaluate locators with document.evaluate, which implements XPath 1.0 only, and ends-with() arrived in XPath 2.0. Selenium 4 offers no way to raise that version, so you emulate it with substring and string-length.
In Selenium, why does re-finding a parent WebElement not refresh the child elements found through it?
level: seniorimportance: nice to knowfreq 36%
basics
~20 sA nested find resolves once and returns a handle on one node, with no link back to the parent. Re-finding the parent only re-runs the parent's locator, so the child references still point at the nodes a re-render discarded.
showing 31–32 of 32