irom
irom

Reputation: 3606

angular protractor no element found using locator

I am using protractor locator below and

element(by.css('.config1100 .btn btn-default btn-lg')).click();

getting following error

NoSuchElementError: No element found using locator: By.cssSelector(".config1100 .btn btn-default btn-lg")

html is templateURL of anuglar-ui view

<div class="row">
    <div class="config1100" ng-include="'../data/config1100.html'"></div>
    <p>
        <button type="button" class="btn btn-default btn-lg" ng-click="save()">Save</button>
    </p>
</div>

Upvotes: 1

Views: 6540

Answers (2)

Vlad A
Vlad A

Reputation: 154

You were missing a dot, so using the dollar shortcut notation:

$('.config1100 .btn .btn-default .btn-lg')).click();

Upvotes: 2

MBielski
MBielski

Reputation: 6620

Might be simpler to use by.buttonText

element(by.buttonText('Save')).click();

http://www.protractortest.org/#/api?view=ProtractorBy.prototype.buttonText

If you have more than one button with that text, grab the collection with element.all and figure out which one you need.

Upvotes: 4

Related Questions