Posts

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

How to test an API.

Image
Before going to API testing, let's first understand What is an API? API is an acronym for  A pplication  P rogramming  I nterface. It enables communication and data exchange between two separate software systems. A software system implementing an API contains functions/sub-routines which can be executed by another software system. What is API testing? API testing is entirely different from GUI testing and mainly concentrates on the business logic layer of the software architecture. This  testing won't concentrate on the look and feel of an application. Instead of using standard user inputs(keyboard) and outputs, in API Testing, you use software to send calls to the API, get output, and note down the system's response. API Testing requires an application to interact with API. In order to test an API, you will need to Use Testing Tool to drive the API Write your own code to test the API Set-up of API Test environment API testing is different than ot

SQL NULL Functions.

SQL ISNULL(), NVL(), IFNULL() and COALESCE() Functions. Look at the following "Products" table: P_Id ProductName UnitPrice UnitsInStock UnitsOnOrder 1 Jarlsberg 10.45 16 15 2 Mascarpone 32.56 23   3 Gorgonzola 15.67 9 20 Suppose that the "UnitsOnOrder" column is optional, and may contain NULL values. We have the following SELECT statement: SELECT ProductName,UnitPrice*(UnitsInStock+UnitsOnOrder) FROM Products In the example above, if any of the "UnitsOnOrder" values are NULL, the result is NULL. Microsoft's ISNULL() function is used to specify how we want to treat NULL values. The NVL(), IFNULL(), and COALESCE() functions can also be used to achieve the same result. In this case we want NULL values to be zero. Below, if "UnitsOnOrder" is NULL it will not harm the calculation, because ISNULL() returns a zero if the value is NULL: MS Access SELECT ProductName,UnitPrice*(UnitsInStock+IIF(ISNULL(UnitsOnOr

SQL Injection.

Image
An SQL Injection can destroy your database. SQL in Web Pages When SQL is used to display data on a web page, it is common to let web users input their own search values. Since SQL statements are text only, it is easy, with a little piece of computer code, to dynamically change SQL statements to provide the user with selected data: Server Code txtUserId = getRequestString("UserId"); txtSQL = "SELECT * FROM Users WHERE UserId = " + txtUserId; The example above, creates a select statement by adding a variable (txtUserId) to a select string. The variable is fetched from the user input (Request) to the page. The rest of this chapter describes the potential dangers of using user input in SQL statements. SQL Injection SQL injection is a technique where malicious users can inject SQL commands into an SQL statement, via web page input. Injected SQL commands can alter SQL statement and compromise the security of a web application. SQL Injection B