Search code examples
angularjsprotractorangularjs-e2ee2e-testing

protractor - issues with scrolling into infinite scroller


I have a protractor test looking for a record in my infinite scroller component like this.

 searchPage.searchEntitlement('search criteria');
    var myHiddenElementInScroller = element(by.repeater('result in ctrl.results track by $index').row(12));
    browser.driver.executeScript(function () { arguments[0].scrollIntoView(); }, myHiddenElementInScroller .getWebElement());

myHiddenElementInScroller.click();

This is supposed to scroll to the element and click it. Instead its throwing me element not visible error.

Has anyone come across this situation? Any help greatly appreciated.


Solution

  • Thanks for all the responses. I was able to resolve this issue by using element(by.CssContainingText(cssSelector, searchText)) locator.