Saturday, July 2, 2022

RunTest case in Firefox browser

 What is GeckoDriver

Gecko is a web browser engine developed by Mozilla. Link between Selenium tests and gecko-based browsers, such as Firefox and other applications.




[write in-progress]




Tuesday, December 7, 2021

Execute Test case on Chrome Browser using Selenium WebDriver

Execute Test case on Chrome Browser using Selenium WebDriver


Step1: download jar file from: https://www.selenium.dev/downloads/



Step2. download ChromeDriver from:  https://chromedriver.chromium.org/downloads



Step3: Create a Simple Java Project




Step4: Create the Test case and Execute








....

Friday, November 12, 2021

Create first test case in Selenium

We going to create the Frist Test case in Selenium Webdriver. following steps to create a Test case.


Required: 

  • Selenium Jar files,  

  • ChromeDriver


Step1:  Initialize Webdriver


System.setProperty java system property is a key-value pair. Each browser has its own WebDriver implementation. Selenium to interact with the browser-specific driver we need to specify the driver and path of the driver.



WebDriver is the Interface which contains all the Selenium method signatures like findElement(), switchTo(), get() etc.

the driver is a reference variable, ChromeDriver() is a Constructor, new is a keyword and new ChromeDriver() is an Object. 


Step2: Launch Webpage using WebDriver


  • get(): method is used WebDriver will wait until the page has fully loaded. It doesn't maintain the browser History and cookies. we can't use forward and backward.

  • navigate(): method is used to navigate to a particular web page. does not wait to page fully load. It maintains browser history and cookies. 


We can use navigation between the pages back, forward and refresh.


3.  Close Webdriver


  • Close(): method is used to close the currently open window on which driver has focus on. 

  • Quit(): This method is used to destroy the instance of WebDriver. It closes all browser windows associated with that driver and safely ends the session.


Sample Code:

 

package DemoTestCase;

import org.openqa.selenium.By;

public class FirstTestCase {
	
	public static void main(String args[]) {
	      
	    System.setProperty("webdriver.chrome.driver", "C:\\Users\\RMJ\\eclipse-workspace\\SeleniumFirstTestCase\\Drivers\\chromedriver.exe");  
	    WebDriver driver=new ChromeDriver();  
	      
	  
	    driver.navigate().to("http://www.google.com/");  
	            
	    driver.findElement(By.id("lst-ib")).sendKeys("javatpoint tutorials");  
	            
	    driver.findElement(By.name("btnK")).click();  
	}

}







Sunday, October 10, 2021

Select Option - Selenium Webdriver

Select is a class in SeleniumWebdriver which is used to Select and Deselect in a Dropdown List element.

 

WebElement country= driver.findElement(By.id("drpCountry"));

Select dropdown = **new** Select(country); 




Sunday, September 19, 2021

findElement and findElements


findElement and findElements are selenium commands which are used to locate elements in Web pages using different ways such as


ID driver.findElement(By.Id("Login"));
Name driver.findElement(By.Name("Login"));
ClassName driver.findElement(By.ClassName("Login"));  
LinkText driver.findElement(By.LinkText("Login"));
PartialLinkText driver.findElement(By.PartialLinkText("Login"));
TagName driver.findElement(By.TagName("Login"));
XPath driver.findElement(By.XPath("Login"));

findElement() 

the command used to identify a web element in the web page.

  • This command is used to fetch a single element on the web page
  • It will return the object of the first matching element
  • It will throw NoSuchElementException when there is no element

driver.findElement(By.xpath("//*[@Value='Yes']")).click();

Ex:





findElements() 

the command used to identify a list of web elements in the web page.

  • This command is used to uniquely identify the list of web elements within the web page.
  • If the element doesn’t exist on the page then if no element is found it will return the empty list.

WebElement element = driver.findElement(By.LocatorStrategy("Locator"));

Ex: 












Friday, July 31, 2020

Java Overview

History and Features of Java

Java is an object-oriented programming language, developed by James Gosling in early 1990,  Java Initially designed for small embedded systems in electronic appliance like set up bokes. The earlier name of java - OAK. Following are the list of items Features of java.

  • Simple,
  • Robust,
  • Portable,
  • Platform Independent,
  • Secured, High Performance,
  • Multithreaded,
  • Architectural Neutral,
  • Object-Oriented,
  • Interpreted and dynamic.

Simple

Java doesn't support the pointers and Added concept garbage collection to delete the unused objects in the memory. Execution is timeless.

Robust

Robust simply means strong. Java uses strong memory management, Strong type checking. Run time errors pointed out during compilation. Automatic Garbage collection, lack of pointer concept.  

Portable

when you compile your Java Program. Java compiler (Java c) generate a class with .class extension which contains the bytecode of your java program. byte code can run any platform.