Protractor throwing error Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.xpath
var eleXpath = '//[@data-qa-class="tile" and descendant::[normalize-space(.)="Weights"]]//[@options="ctrl.grid.options"]/[contains(@class, "slick-frozen-rows") and not(contains(@class, "multi-header"))]//[contains(@class, "slick-pane slick-pane-bottom slick-pane-left")]//[contains(@class, "slick-row") and descendant::*[normalize-space(.)="88579YAE"]]';
var rowReferenceXpath = element.all(by.xpath(eleXpath)).get( rowIndex );
rowReference.isPresent().then( function( isRowPresent ) {
if ( !isRowPresent ) {
// If required row is not found reject the promise with error message
defer.reject( '"' +rowName+ '" row is not found in the calculated reported.' );
} else {
// Get the "style" attribute value of the row
var eleRefs = rowReference.getAttribute( 'style' );
} ;
Throwing error as
- Failed: Index out of bound. Trying to access element at index: 0, but there are only 0 elements that match locator By.xpath("//[@data-qa-class=\"tile\" and descendant::[normalize-space(.)=\"Weights\"]]//[@options=\"ctrl.grid.options\"]/[contains(@class, \"slick-frozen-rows\") and not(contains(@class, \"multi-header\"))]//[contains(@class, \"slick-pane slick-pane-bottom slick-pane-left\")]//[contains(@class, \"slick-row\") and descendant::*[normalize-space(.)=\"88579YAE\"]]")