Protractor: Should be able to chain findElement to find child elements

Created on 22 Aug 2013  路  7Comments  路  Source: angular/protractor

This currently doesn't work in webdriver with js selectors, but it's a huge pain when there are two elements with the same binding (e.g. item.name).

enhancement

Most helpful comment

I needed this but the url is 404 https://github.com/angular/protractor/blob/master/spec/basic/findelements_spec.js

All 7 comments

Looking for an example/syntax to do find Elements from a parent fineElement. something like below.
Can you please give me an example how to do this?

ptor.findElements(protractor.By.tagName('tbody').protractor.By.tagName('tr'))

Awesome !!, following works.

        ptor.findElement(protractor.By.tagName('tbody')).findElements(protractor.By.tagName('tr')).then(function(rows){
            expect(rows.length).toBe(10);
        });

Thanks

can the '$' short-hand notation be used to find child elements of an element reference?

for example:

elt = $('.my-parent-class')
children = elt.$$('.my-child-class')

@tony-kerz $ works, but $$ cannot be chained. This inconsistency should probably be fixed.

I needed this but the url is 404 https://github.com/angular/protractor/blob/master/spec/basic/findelements_spec.js


how to locate both in protractor using java script?
@juliemr

Was this page helpful?
0 / 5 - 0 ratings