I get prices, even that I don't need, how can I filter them?
<div class="ssl-price-box">
<price value="377" units="/yr" class="lg-price ng-isolate-scope"><span class="price"><span class="currency-icon">$</span><span class="integer ng-binding">3.</span><span class="cent ng-binding">77</span><span class="units">/yr</span></span></price>
<!-- ngIf: product.prices.max.certIsPromo -->
</div>
<price value="13888" units="/yr" class="lg-price ng-isolate-scope">
<span class="price">
<span class="currency-icon">$</span>
<span class="integer ng-binding">138.</span>
<span class="cent ng-binding">88</span>
<span class="units">/yr</span>
</span>
</price>
<price ng-if="product.prices.max.certIsPromo" value="21589" units="/yr" old-price="" class="base-price ng-scope ng-isolate-scope">
<span class="price old-price">
<span class="currency-icon">$</span>
<span class="integer ng-binding">215.</span>
<span class="cent ng-binding">89</span>
<span class="units">/yr</span>
<span class="line-through"></span>
</span>
</price>
I have no idea how to do it. I tried
const allSSLList = element.all(by.css('div.ssl-price-box')).all(by.className("span[class='price']"));
and this
const allSSLList = element.all(by.css('div.ssl-price-box > price'));
expect(await allSSLList)).toBe(newPrices)
I got all elements, but I don't need old price in tag class="price old-price" from second css, because I need compare Array with all new prices
Expected [ '377', '1288', '2699', '1688', '3199', '1966', '3588', '3088', '4499', '3888', '9599', '5999', '6888', '13899', '7088', '9699', '7819', '7819', '13499', '13888', '21589' ] to be 'newPrice'.
With the HTML provided, it looks like you can use the XPath
to only get the price that aren't old prices. From there, you can use
.getAttribute()to pull thevalueattribute from each element as "377", "1288", etc.