package org.example;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
public class Datatable {
public WebDriver driver;
public String baseurl="https://datatables.net/";`enter code here`
public void find() throws Exception{
System.setProperty("webdriver.chrome.driver","C:\\Users\\Asus\\Downloads\\chromedriver_win32
(2)\\chromedriver.exe");
driver= new ChromeDriver();
driver.manage().window().maximize();
driver.get(baseurl);
List<WebElement> col=driver.findElements(By.xpath("//div[@class=\"hero-
callout\"]//thead//tr//th"));
System.out.println("No of columns are:"+(col.size()-1));
List<WebElement>
row=driver.findElements(By.xpath("//table[@id=\"example\"]/tbody/tr/td[1]"));
System.out.println("No of rows are:"+row.size());
driver.findElement(By.xpath("//div[@id=\"example_filter\"]//input[@type=\"search\"]")).sendKeys("Accountant"); Thread.sleep(5000); driver.findElement(By.xpath("//div[@id=\"example_filter\"]//input[@type=\"search\"]")).sendKeys(Keys.ESCAPE); driver.close(); driver.quit(); } public static void main(String[] args) throws Exception { Datatable CHE=new Datatable(); CHE.find(); } //Reporter.log("Browser open"); //Reporter.log("\n Screen maximised"); }