Imagine a scenario that is much more complex, but let's try to simplify. I am attempting to choose the siblings of an element with the class 'sss' using
$('.sss').parent().parent().find(">div.childCollapsible>div[data-onthemovecollapsible=true]")
I am limited to CSS selectors only (as this is part of a Selenium test). My expectation was to retrieve only the siblings of 'sss', however, I am getting all the children of sub-elements as well.
Is there a way to restrict it to only siblings? Or perhaps another workaround that can help me obtain just the siblings from any element in the tree, specifically those with the
data-onthemovecollapsible="true"
attribute?
EDIT: Let me clarify my issue. The structure I am dealing with is an 'infinite tree structure' with an unknown number of nodes on each layer. What I'm seeking is the ability to fetch siblings at the same level where I start the search and exclusively their parent's children (siblings + self). All levels of the tree have identical HTML syntax, so the CSS selector should be the same across them. I am restricted to using only the 'find' method in jQuery and can use only CSS selectors since this mechanism is part of a Selenium test and requires By.CssSelector("..."). While I can move up the elements using element.FindElements(By.XPath("..")) to reach the parent, from the parent's position, I aim to grab all siblings without children (with identical html syntax) simultaneously. So, ideally, a selector specific to a particular layer would suffice (like the one in the jsfiddle link below), however, it currently selects all child nodes too - not adhering to the '>' operator for some reason. This could work perfectly if I could use all jQuery functions.
$('.sss').parent().parent().children().children()
I am looking for the same outcome but achieved with a CSS selector.