0 votes
1 view
in Devops and Agile by (25k points)

I already tried using the ">" syntax but selenium does not accept it, I know there is a way to get it using Xpath but our entire project is written using CSS selectors.

I am trying to store a list that will contain all immediate children of an element but not their children (descendants), when I use the "*" syntax I get all the element's descendants.

1 Answer

0 votes
by (63.3k points)
edited by

You should specify a tag to start out from, if you want "all element's immediate children", you'd easily get all elements, but that isn't what you really want.

 

To get "all immediate children of an element but not their children" for the body, use 

body > *.

Or another example would be if you want to get all direct descendants of <div id='question'>, use div#question > *.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...