Posts

Showing posts from February, 2017

How to get live train status from NTES via Automation.

package trainstatus; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; public class train_status { public static void main(String[] args) throws InterruptedException { System.setProperty("webdriver.chrome.driver", "/home/techens/chromedriver/chromedriver");  WebDriver driver=new ChromeDriver();  driver.navigate().to("http://enquiry.indianrail.gov.in/ntes/"); //Navigate to NTES  Thread.sleep(3000);  driver.findElement(By.cssSelector("#ui-id-16 > button > span")).click(); //Clicks on Enter train number value  Thread.sleep(3000);  driver.findElement(By.id("trainInput")).sendKeys(""); //Input train number (eg. 12034, 12033 etc.)  Thread.sleep(3000);  driver.findElement(By.id("passThrStn")).click(); //Clicks on Journey/Boarding/Arrival station  Thread.sleep(3000);  driver.findElement(

How to get PNR Status in IRCTC using Automation.

package Testing_Pack; import org.openqa.selenium.WebDriver; import org.openqa.selenium.By; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; public class mytestclass { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver", "/home/techens/chromedriver/chromedriver");  WebDriver driver=new ChromeDriver(); //Created an object "driver" contains function Chrome Driver driver.navigate().to("https://www.trainspnrstatus.com/"); // Navigate to URL driver.findElement(By.id("fullname")).sendKeys("2808506351"); //enter 10 digit PNR number driver.findElement(By.cssSelector("#contact_form > div > button")).click(); //Clicks on "Check" button } }