@@ -500,11 +500,14 @@ private ComparisonState CompareNodeLists(IEnumerable<XmlNode> allControlChildren
500500 }
501501
502502 return chain
503- . AndThen ( UnmatchedControlNodes ( controlList , controlContext , seen , testContext ) )
504- . AndThen ( UnmatchedTestNodes ( testList , testContext , seen , controlContext ) ) ;
503+ . AndThen ( UnmatchedControlNodes ( controlListForXpath , controlList , controlContext ,
504+ seen , testContext ) )
505+ . AndThen ( UnmatchedTestNodes ( testListForXpath , testList , testContext , seen ,
506+ controlContext ) ) ;
505507 }
506508
507- private Func < ComparisonState > UnmatchedControlNodes ( IList < XmlNode > controlList ,
509+ private Func < ComparisonState > UnmatchedControlNodes ( IList < XmlNode > controlListForXpath ,
510+ IList < XmlNode > controlList ,
508511 XPathContext controlContext ,
509512 ICollection < XmlNode > seen ,
510513 XPathContext testContext ) {
@@ -513,7 +516,8 @@ private Func<ComparisonState> UnmatchedControlNodes(IList<XmlNode> controlList,
513516 int controlSize = controlList . Count ;
514517 for ( int i = 0 ; i < controlSize ; i ++ ) {
515518 if ( ! seen . Contains ( controlList [ i ] ) ) {
516- controlContext . NavigateToChild ( i ) ;
519+ controlContext
520+ . NavigateToChild ( controlListForXpath . IndexOf ( controlList [ i ] ) ) ;
517521 try {
518522 chain = chain
519523 . AndThen ( new Comparison ( ComparisonType . CHILD_LOOKUP ,
@@ -532,7 +536,8 @@ private Func<ComparisonState> UnmatchedControlNodes(IList<XmlNode> controlList,
532536 } ;
533537 }
534538
535- private Func < ComparisonState > UnmatchedTestNodes ( IList < XmlNode > testList ,
539+ private Func < ComparisonState > UnmatchedTestNodes ( IList < XmlNode > testListForXpath ,
540+ IList < XmlNode > testList ,
536541 XPathContext testContext ,
537542 ICollection < XmlNode > seen ,
538543 XPathContext controlContext ) {
@@ -541,7 +546,7 @@ private Func<ComparisonState> UnmatchedTestNodes(IList<XmlNode> testList,
541546 int testSize = testList . Count ;
542547 for ( int i = 0 ; i < testSize ; i ++ ) {
543548 if ( ! seen . Contains ( testList [ i ] ) ) {
544- testContext . NavigateToChild ( i ) ;
549+ testContext . NavigateToChild ( testListForXpath . IndexOf ( testList [ i ] ) ) ;
545550 try {
546551 chain = chain
547552 . AndThen ( new Comparison ( ComparisonType . CHILD_LOOKUP ,
0 commit comments