Eyosiyas Tadele
Eyosiyas Tadele

Reputation: 303

Element not visible in protractor ionic

I have been testing a user acceptance testing using protractor and I have got something uncaught terrible bug ElementNotVisibleError: Element is not currently visible and so may not be interacted with Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16' ....

Here is the element that I need to refer using protractor.

<button style="" class="button back-button buttons  button-clear  header-item" ng-click="$ionicGoBack()">
  <i class="icon ion-ios-arrow-back"></i> 
  <span style="transform: translate3d(0px, 0px, 0px);" class="back-text"><span class="default-title hide">Back</span>
 <span class="previous-title">Power of Attorney/Authentication</span></span></button

>

I use this protractor syntax to locate this element

var btn = element(by.css('button.button.back-button.buttons.button- clear.header-item'));

btn.click(then(function(){


  // I do something with it here
});

Upvotes: 1

Views: 291

Answers (1)

Priyanshu
Priyanshu

Reputation: 3058

The css selector which you have written does not seem correct.

var btn = element(by.css('.back-button'));

btn.click(then(function(){
// Do something
});

Since as per your snippet .back-button looks unique so above code should work.

Other css locators you can also try with:

.button.back-button

.button.back-button.buttons.button-clear.header-item

Upvotes: 1

Related Questions