Selenium WebDriver (Java) with database



  • I want to validate application output result with Database using selenium webdriver (Java). Please let me know how this can be achieved. Or could you please let me know how to use selenium webdriver with database?. I am able to connect to database by below code. Code to connect to database: import java.sql.*; public class Db1 { static final String JDBC_DRIVER = "org.gjt.mm.mysql.Driver"; static final String DB_URL="jdbc:mysql://111.0.0.1:12345/actitime"; static final String USER ="actitime"; static final String PASS ="actitime1"; public static void main(String[]args){ Connection conn=null;Statement stmt=null; try{ Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection(DB_URL, USER, PASS); System.out.println("Connected database successfully"); System.out.println("Creating statement"); stmt=conn.createStatement(); ..... ..... But not not sure how to validate result of the application using selenium webdriver and result saved in the database.



  • It sounds like the majority of your issue is in creating the connection to your Database. However, you lack to mention the type of database so I will try and cover some of the more popular ones. Oracle Tutorial or SO Question SQL Server JTDS I could list all of the types of databases for years so here is a list of database related tutorials. If you need more specific help than please ask a more specific question. From the comments: Obtain the data from the Application that will need to be validated against the database Obtain the data from the database Compare the results



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2