I am new to selenium. I want to verify data shown in grid on my web application page with database value.

I have gone through blogs, and what I have found is:

Using Selenium Webdriver in C#:

i. Connect to database and execute the query and get data.
ii. Get parent element of data shown on screen and loop through its child element and match the data.

Is there any better way available to validate data (let's say data in grid) shown on web page with database using selenium webdriver?

Using IDE: I have searched for this but I have not found any way to connect selenium IDE with database (in my case, SQL Server).

Let me know if I have missed something or misunderstood the concept.


2 Answers 2


We did it the same way using C#. Unless it is really slow I would leave it like this. The only suggestion I would have would be to give each cell a unique identifier so you can use the quick "by id" locator.

You could also check that the MAX+1 rows / columns don't exist if you want to be really rigorous.

  • 1
    +1 for using ids. I would even ask for ids in a format like "rowid-columnname", so it is easy to navigate there.
    – dzieciou
    Mar 13, 2016 at 13:27

I had come across a similar issue . When I inspected the DOM for both List and Grid View , I found classes with the view name . I then asserted if the classes were present . This ensures the view is either grid view or list view

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.