0
votes

In my testing phase I want to test a header element h2 in html

<a class="item-content" ng-href="#/lead/details/1/" target="_self" href="#/lead/details/1/">

                <div class="row" style="height: 35px; width: 100%; margin-left:-10px; margin-top: -10px; margin-right: 0px; padding: 0px"> 
                    <div class="col col-top col-67">
                        <h2 class="ng-binding">HAL 9000</h2>
                        <br>
                        <h4 style="font-weight: normal; margin-top: -15px" class="ng-binding">Jupiter &nbsp; Feb 10, 2025 </h4>
                    </div>

                    <div class="col col-center col-10 col-offset-25" style="margin-right: -10px">
                        <a href="tel:9876543210" ng-click="$event.stopPropagation()">
                            <i class="icon ion-ios-telephone-outline" style="font-size: 36px"></i>                       
                        </a>
                    </div>
                    <div class="col col-center col-20" style="margin-left: 15px">
                        <a href="mailto:[email protected]?Subject=Hi;" ng-click="$event.stopPropagation()">
                            <i class="icon ion-ios-email-outline" style="font-size: 36px;"></i>
                        </a>
                    </div>
                </div>        
            </a>

I wanted to test that the "Hal 9000" is visible or not could someone help me to find it in my protractor testing process in my protractor I used

var child = element(by.css('.col col-top.col-67')), element(by.css('.ng-binding'));

it('20 should update 2nd lead with proper data',function(){
expect(child.getText()).toBe('HAL 9000'); });

and i get an error message in my terminal as NoSuchElementError: No element found using locator: By.cssSelector(".col col-top.col-67") someone help me to fix this problen

1
There seems to be typo here. This '.col col-top.col-67' should be '.col.col-top.col-67'Chandermani
thank you very much it worked.Yokesh Varadhan
i need to call the 2nd element in the array i used this "expect(child.get(1)).toMatch('HAL 9000'); " i get this error statement in my terminal window with a big paragraph "FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory Abort trap: 6"Yokesh Varadhan

1 Answers

0
votes

for a more precise locator, you can always use:

element(by.css('.col.col-top.col-67 h2');