Display results as :

Rechercher Advanced Search

Latest topics
» FlexMonkium Download Not available under Gorillalogic site
Thu Dec 08, 2016 5:40 pm by bhanu.praveen

» Selenium Script issue
Tue Dec 06, 2016 9:48 pm by njain213

» Difference between QTP, Selenium and Silk test
Tue Dec 06, 2016 7:58 pm by jessicacyrus1

» Where does selenium script pick browser from
Tue Dec 06, 2016 1:52 pm by janbaskt

» Safari throws an HTTP ERROR: 404
Tue Dec 06, 2016 1:51 pm by janbaskt

» Access Denied Error in Selenium RC
Tue Dec 06, 2016 1:51 pm by janbaskt

» Automating Flex application through selenium webdriver
Fri Dec 02, 2016 2:06 pm by abhinay.krs

» Starting with Selenium, what is Selenium?
Mon Nov 28, 2016 4:00 pm by Foma

» Getting started with Selenium
Mon Nov 28, 2016 3:23 pm by Rebbelx


How to Sort List<WebElements>

View previous topic View next topic Go down

How to Sort List<WebElements>

Post by nag6789 on Tue Jun 10, 2014 9:14 pm

Details Steps are below.
1. Opened Ebay Site
2. Searched for LED TV
3. Captured prices of the results
    List uiAllPrices = oBrowser.findElements(By.xpath("//td[@class='prc']/div//div[@itemprop='price']/span"));

For example: If 3 types of LED TV's shown up in the results with the Prices like 20, 10, 50

4. Now I would like to sort the values captured in uiAllPrices.
Example: 10, 20, 50 or 50, 20, 10

Any of your help will be greatly appreciated.


Posts : 1
Join date : 2014-06-10

Back to top Go down

Re: How to Sort List<WebElements>

Post by Adviser on Mon Jun 23, 2014 8:42 pm


Best way to store all values of list in Map/Dictionary and then sort on the basis of value.

if your using java, refer following link otherwise find same solution for your prog lang:

Spread Your Knowledge About Selenium Tool.



Posts : 379
Join date : 2009-07-30
Location : India

Back to top Go down

Re: How to Sort List<WebElements>

Post by mail2prassad on Fri Jul 18, 2014 7:35 pm

Collections.sort(uiAllPrices );


Posts : 41
Join date : 2013-06-05

Back to top Go down

Re: How to Sort List<WebElements>

Post by Rajasekhar on Thu Jul 24, 2014 5:53 pm

   Iam giving the code for sorting the list

List namesList=new ArrayList();

Last edited by Rajasekhar on Wed Jul 30, 2014 8:10 pm; edited 3 times in total (Reason for editing :


Posts : 1
Join date : 2014-07-24

Back to top Go down

Re: How to Sort List<WebElements>

Post by nabhanya.varma on Sat Sep 13, 2014 5:30 pm

Please try below
List allOptions = se.getOptions();
// create one list
List list = new ArrayList(Arrays.asList(allOptions));

System.out.println("List value before: "+list);

// sort the list

Active particpant
Active particpant

Posts : 13
Join date : 2014-03-02

Back to top Go down

Re: How to Sort List<WebElements>

Post by Sponsored content Today at 7:16 am

Sponsored content

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

Permissions in this forum:
You cannot reply to topics in this forum