Sorting the Dynamic HTML Table List in Selenium WebDriver & Java



Sorting:
In computer science, a sorting algorithm is an algorithm that puts elements of a list in a certain order. The most frequently used orders are numerical order and lexicographical order or alphabetical order.
In Selenium WebDriver it is important to verify the Sort Functionality of the Dynamic HTML Content
is working as expected.

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Sorting the Dynamic HTML Table-Selenium WebDriver & Java

Steps to Perform:
1. Retrieve the List from HTML Table.
2. Store the List in an Array
3. Sorting the items in the Array using Swapping.
Swapping is the process of Exchanging the Values.
4. Click on Sort button in the WebPage.
5. Retrieve the List again.
6. Compare the Sorted Array generated in Step 3 with the List generated in Step 5.





Selenium WebDriver Logic




Refer to the below Links for Practise
Collections in Java
Complete List of Selenium Basics
50 Real Time Interview Questions
Real Time Scenario’s
Java Platform Standard Edition 8 Documentation
Complete List of Java Basics
Java Quiz
Java OOPS Quiz
Selenium Advanced Quiz
Selenium Quiz
Selenium WebDriver Resume

3 comments on “Sorting the Dynamic HTML Table List in Selenium WebDriver & Java

  1. Anonymous

    thanks for sharing the sorting trick but I think there is something missing here
    for(int j=i+1;j < i;j++)
    {

    }
    .consider the loop if : j=1,i=0,1<0 -this will neve get executed, It should be instead
    and first loop I loop should start with 1
    // outer loop
    for(int i=1;i < strarr.length;i++)
    {
    //inner loop
    for(int j=i-1;j < i;j++)
    {
    strar[i]compare(strarr[j]);
    ///comparison logic
    }

    }

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *