Search code examples
javascripttestingseleniumprotractorend-to-end

How to identify this element in protractor?


When I view some customer information, I see the customer information displayed at the bottom. I believe it comes from JSON call.

How to identify this element? I tried className but not working. Thanks for your help. And tried this css as well. .override-info hide-mobile ng-scope. I need to assert the name matches to John Grish:

<div class="override-info hide-mobile ng-scope" ng-if="overrideCustInfo">
    <p class="override-info-title">You are viewing</p>
    <p class="override-info-dtl ng-binding">John Grish</p>
    <p class="override-info-dtl ng-binding">1177 Montogomery st</p>
    <p class="override-info-dtl ng-binding">San Francisco, CA</p>
</div>

Solution

  • You can rely on class names:

    expect(element
        .all(by.css("div.override-info p.override-info-dtl"))
        .first().getText()
    ).toEqual("John Grish");