I have 4 container boxes on a page which are identical. I have taken all of them in an array. Now each container box contains some elements which are identical as well. I want to fetch 2nd element from 1st container. Below is what i used to fetch my container and it is working fine:
var pageContent = element(by.css('[class="main-content"]'));
expect(pageContent.all(by.css('.modularBoxContent')).count()).tobe(4);
Now if i want to fetch count of all elements with class as labelText insider modular box container, i am able to do that by using below:
expect(pageContent.all(by.css('.modularBoxContent')).all(by.css('[class="labelText"]')).count()).tobe(10);
But this is giving me labelText present in all 4 containers. I want to get count of labelText only in first container or get text of first labelText in first container. I tried below code but it is not working and getting error message
TypeError: this.pageContent.get is not a function
expect(pageContent.get(0).all(by.css('.modularBoxContent')).all(by.css('[class="labelText"]')).count()).tobe(3);
I also tried below but that is not working as well. Getting same error as above for this as well.
expect(pageContent.all(by.css('.modularBoxContent')).get(1).all(by.css('[class="labelText"]')).get(0).getText()).tobe(3);
Can someone please suggest correct usage?
.get()on a single element, only an element array. If it wasvar pageContent = element.all(by.css('[class="main-content"]'));it would work. So are the 4 main containers all with classmain-content?