I have a list of Airlines deals which has Fare in the form of
C$145.19,C$298.17,CC$398.17,C$876.21,C$1001.71
and the deal is shown on the basis of fare sorted from lower to higher.
I have to create a script which pulls this fare and check whether the deals is appearing on the basis of fare from lower to higher. But I am using the array list as string instead of double.
How to convert the string arraylist into the double so that the arraylist could return sorted value?
Code:
ArrayList<String> dealList = new ArrayList<>();
List<Webelement> deals = driver.findelements(By.xpath//"div[@class='xyz']");
// It pulls out all the Fare with same Xpath which is almost 10 value.
for(Webelement w: deals)
{
deallist.add(w.gettext());
}
ArrayList<String> newDeaList = new ArrayList<>();
for(String s: dealList)
{
newDealList.add(s);
}
Collections.sort(newDealList);
Assert.Assertequals(dealList,newDealList);
But I am not getting the correct output .
Output Value:
C$145.19,C$298.17,CC$398.17,C$876.21,C$1001.71