I have a protractor webElementFinder testElement
. I want to match only its div
children (NOT grandchildren or any other further descendants) and thus testElement.find('div')
will not work as it will find all descendant divs.
If protractor worked like jQuery (which would make sense since Angular is smart enough to use jQuery if its present and protractor is built with Angular in mind), I would just do testElement.find(' > div')
which would work despite the find
argument not being a valid CSS selector by itself; however because protractor just uses built in Element functions, that CSS selector is not valid by itself, and protractor throws an error.
I could go this route Angular JS, Protractor locator, get direct children of element since xpath natively lets you look at children, but I'd much rather use CSS than xpath.