量角器抛出错误失败:索引超出范围。尝试访问index:0处的元素,但只有0个元素与定位器By.xpath匹配
var eleXpath =&#39; // [@ data-qa-class =&#34; tile&#34;和后代:: [normalize-space(。)=&#34; Weights&#34;]] // [@ options =&#34; ctrl.grid.options&#34;] / < / em> [contains(@class,&#34; slick-frozen-rows&#34;)而不是(包含(@class,&#34; multi-header&#34;))] // [包含(@class,&#34; slick-pane slick-pane-bottom slick-pane-left&#34;)] // [contains(@class,&#34; slick-row&#34;)和后代:: * [正常化空间=&#34(。); 88579YAE&#34;]]&#39 ;;
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' );
} ;
投掷错误
答案 0 :(得分:0)
看起来你可能错过了eleXpath的转义
var eleXpath ='// [@ data-qa-class =“tile”and descendant :: [normalize-space(。)=“Weights”]] // [@ options =“ctrl.grid.options” ] / [contains(@class,“slick-frozen-rows”)而不是(包含(@class,“multi-header”))] // [contains(@class,“slick-pane slick-pane-bottom slick” -pane-left“)] // [contains(@class,”slick-row“)和descendant :: * [normalize-space(。)=”88579YAE“]];
与
var eleXpath ='// [@ data-qa-class =“tile”and descendant :: [normalize-space(。)=“Weights”]] // [@ options =“ctrl.grid.options” ] // [contains(@class,“slick-frozen-rows”)而不是(包含(@class,“multi-header”))] // [contains(@class,“slick-pane slick-pane-bottom” slick-pane-left“)] // [contains(@class,”slick-row“)和descendant :: * [normalize-space(。)=”88579YAE“]];