Posts

Showing posts from October, 2021

Database Connection

 class DbConnection {     {               Connection con=DriverManager.getConnection( "jdbc:postgresql://" + hostname + ":" + port + "/" + dbname , username , password );          Statement stmt=con.createStatement();          ResultSet rs=stmt.executeQuery("select * from students where id=123456");          while(rs.next())          {                 System.out.println(rs.getString(1));           }     }     catch(SQLException e)     {          e.printStackTrash();          } }

Locators in selenium(for locating web element-static method in By class)

2 locator inspect element on web page <input placeholder="Patient First Name" maxlength="30" class="form-control jqName" size="30" type="text" name="appointment[patient_ attributes][firstname]" id="appointment_patient_ attributes_firstname"> id unique driver.findElement(By.id(" appointment_patient_ attributes_firstname")); class driver.findElement(By.class(" form-control jqName")); classname driver.findElement(By. className("appointment[ patient_attributes][firstname] ")); cssSelector() WebElement ref = driver.findElement(By. cssSelector("input[class=' form-control jqName']")); <a href=" https://www.credihealth. com/doctors ">Doctors Network</a> linkText() WebElement ref = driver.findElement(By. linkText("Doctors Network")); partiallinktext() WebElement ref = driver.findElement(By. partialLinkText("Doctors Net")); tagName ...