-3

I have a list of arrays {1,2,3}. and I have a xpath. what I actually need is with the xpath the output will be any of the array either 1 or 2 or 3. I want to assert the value and pass the test using testng.

Is there any possibility to do something like that.

Arun Kumar
  • 139
  • 1
  • 13
  • I think you can use [hamcrest](http://openwritings.net/content/public/excerpt/using-hamcrest-testng) with TestNG. See example from [this](http://stackoverflow.com/questions/1092981/hamcrests-hasitems) – Buaban Apr 27 '16 at 09:39

1 Answers1

0

I am not sure whether I got your question correctly. But if you want to compare the text in an element with given values, you can save these three elements in a list and use contains

ArrayList<String> arrayList = new ArrayList<String>();
arrayList.add("1");
arrayList.add("2");
arrayList.add("3");

Assert.assertTrue(arrayList.contains(YourElement.getText()));
Prateek
  • 1,145
  • 1
  • 8
  • 21