C Program which prints itself
package com.selenium.test;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.support.ui.WebDriverWait;
public class Alert1 {
public static void main(String[] args) throws InterruptedException {
 WebDriver driver = new ChromeDriver();
 driver.get("https://www.ksrtc.in/oprs-web/");
 Thread.sleep(2000); 
 driver.findElement(B y.xpath(".//*[@id='searchBtn']")).click();
 String actual = driver.switchTo().alert().getText();
 driver.switchTo().alert().accept();
 // .dismiss is used to click on the
 // second option in a pop up message
 // driver.switchTo().alert().dismiss();	
 // test will fail because expected is different 
 String expected = "Please select start place";
 if (actual.equalsIgnoreCase(expected)) {
	System.out.println("Test Pass");
 } else {
	System.out.println("Test Failed");
 }
}
}