Forum Discussion

radhika1's avatar
radhika1
Contributor
7 years ago

how to use a variable in context.expand

Can u tell me how to use a variable inside this.   def y =1;   def g  = context.expand('${Operation#Response#//*//consumerProfile/phoneNumber["+y+"]}');   this is not taking 1 as value of...
  • JHunt's avatar
    JHunt
    7 years ago

    Some other problem with this Xpath then?

     

    def y = 1
    assert '${Operation#Response#//*//consumerProfile/phoneNumber[' + y + ']}' == 
    '${Operation#Response#//*//consumerProfile/phoneNumber[1]}'