Posts

Showing posts from 2017

How to handle vertical & Horizontal Autoscroll using selenium webdriver.

Handling Auto scroll with selenium Webdriver is very easy just copy & paste the below script and it's done... JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("window.scrollBy(0,700)"); Note: Where "0" handle Horizontal scroll &  "700" handle Vertical scroll.

Some Important topics for Advance Selenium.

Note: These Codes are verified & Implemented by me in Eclipse using Selenium Webdriver. **How to Implement Drag&Drop using Selenium webDriver: WebElement Source=driver.FindElement(by.cssSelector("")); //Element which to Drag WebElement Target=driver.FindElement(by.id("")); //Element where to Drop (new Actions(driver).dragAndDrop(Source, Target).Perform(); //Action to perform Drag&Drop feature **How to Implement Double click using Selenium WebDriver: WebElement target=driver.FindElement(by.id("")); //Element to be clicked (new Actions(driver)).DoubleClick(target); //Action to perform double click **How To Implement Mouseover/Mousehover using Selenium Webdriver: WebElement target=driver.FindElement(by.id("")); //Element where to move mouse pointer (new Actions(driver)).MovetoElement(target); //Action to perform Mouseover **How to handle Upload fields in Selenium Webdriver: WebElement fileupload=dri

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 } }