How to solve ElementNotVisibleError: Element not showing in protractor

var spinner = element(by.css('.glyphicon.glyphicon-ok.green:not(.ng-hide)'));
expect(spinner.isDisplayed()).toBeTruthy();
spinner.click();

      

when i execute this i always get error like

ElementNotVisibleError: element not visible

      

I want to highlight this element

<span class="glyphicon glyphicon-ok green" data-ng-show="Choice.IsCorrect"/>

      

and don't select another item like

<span class="glyphicon glyphicon-ok green ng-hide" data-ng-show="Choice.IsCorrect"/>

      

+3


source to share


1 answer


The correct way to do it is below

var popUp = ($('[data-ng-show="Choice.IsCorrect"].glyphicon.glyphicon-ok.green:not(.ng-hide)'));
popUp.click();

      



so that it always returns the visible element and can click on it.

Thanks to everyone who looked into it.

+2


source







All Articles