Can't find elements of element

transient_loop

In my tests, I need to first find a specific product, and then do some operations on some subelements of that product. There are many products.

This is my first protractor scripts so bear with me.

var prod = element.all(by.css('singleproduct')).get(1);

singleproduct is a directive. This is the part of the scripts which breaks:

prod.element(by.css(".product-ordering ul li")).each(function(elem) {

})  

However, I always get element(...).each is not a function

HTML:

<singleproduct ng-repeat="item in vm.products" item="::item" class="col-xs-12 col-sm-6 col-md-4 product_tile ng-scope ng-isolate-scope">
   <article ng-class="{'product--active': isSelected}" class="product">
      <section ng-click="toggleDetails()" class="product-content">
         <!-- some prod info --> 
      </section>
      <section>             
         <div class="product-ordering">
            <ul class="product-quantities">
               <!-- ngRepeat: option in ::priceList --> 
               <li ng-repeat="option in ::priceList" class="ng-scope">
                  <!-- this is the LI I want to catch...
               </li>
               <!-- end ngRepeat: option in ::priceList --> 
               <li ng-repeat="option in ::priceList" class="ng-scope">
                  <!-- this is the LI I want to catch...

               </li>
               <!-- end ngRepeat: option in ::priceList --> 
               <li ng-repeat="option in ::priceList" class="ng-scope">
                  <!-- this is the LI I want to catch...
               </li>
               <!-- end ngRepeat: option in ::priceList --> 
            </ul>
         </div>
      </section>
   </article>
</singleproduct>
Sudharsan Selvaraj

each() function will work only with array. but prod.element(by.css(".product-ordering ul li")) will return you a ElementFinder and not ElementArrayFinder. you need to use product.all() instead of product.element(). Look at below example.

prod.all(by.css(".product-ordering ul li")).each(function(elem) {

}) 

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Selenium can't find element

From Dev

Javascript: can't find element

From Dev

Can't find element in frame

From Dev

Can't find element in frame

From Dev

Can't find an element by "querySelector"

From Dev

Why can't .each() find the child elements?

From Dev

can't find elements returned by Ajax

From Dev

Selenium can't find elements with dynamic IDs

From Dev

Can't find DOM element in jQuery

From Dev

IndexOf can't find last element in a List

From Dev

why can't find/parse this element in HTML?

From Dev

Can't find specific element in LinkedListNode

From Dev

Selenium IDE can't find an element

From Dev

Can't find an element Selenium Python

From Dev

jQuery: "this" can't find element generated by .html()

From Dev

Can't find element to make if statement

From Dev

PhotoSwipe Can't Find Element At Different Layout

From Dev

Can't find element by id using selenium

From Dev

Can't find element selenium python

From Dev

Protractor can't find element by binding $ctrl

From Dev

Can't find element by xpath with title as a variable

From Dev

can't find my element (selenium beginner)

From Dev

AngularJS Protractor element by.model can't find element?

From Dev

Polymer querySelector can't find custom polymer element in polymer element

From Dev

Polymer querySelector can't find custom polymer element in polymer element

From Dev

Can't find the id of parent element of clicked element using jquery

From Dev

How to find the parent element If I don't know number of elements that is present between the child element and the Parent element

From Dev

Can't move element away from other elements in HTML file?

From Dev

Can't move element away from other elements in HTML file?

Related Related

HotTag

Archive