//xpath using contains
package Pack1;
import [Link];
import [Link];
import [Link];
public class Class1 {
public static void main(String[] args)
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
[Link]([Link]("email")).sendKeys("Fahad");
[Link]([Link]("pass")).sendKeys("Fahad");
//[Link]([Link]("//input[@id,'u_0_')]")).click();
[Link]([Link]("//input[contains(@id,'u_0_')]")).click(); //using
contains
//dropdown selection
package Pack1;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class Class2 {
public static void main(String[] args) throws InterruptedException {
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
WebElement day1= [Link]([Link]("day"));
WebElement month1 = [Link]([Link]("month"));
WebElement year1 = [Link]([Link]("year"));
Select dayselect = new Select(day1);
[Link](10);
[Link](3000);
Select monthselect = new Select(month1);
[Link]("July");
[Link](3000);
Select yearselect = new Select(year1);
[Link]("1993");
[Link](3000);
[Link]([Link]("//input[@value='1']")).click();
//using of getCurrenturl and getTitle
package Pack1;
import [Link];
import [Link];
public class Class3 {
public static void main(String[] args) {
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
//[Link]([Link]("//input[@value='1']")).click();
String s1 = [Link](); //getting current url
String s2 = [Link](); //getting title
[Link]("the current url is" + s1);
[Link]("the title is : " + s2);
//use of forward and back
package Pack1;
import [Link];
import [Link];
public class Class4 {
public static void main(String[] args) {
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
[Link]().to("[Link]
[Link]().forward();
[Link]().back();
}
//use of alerts
package Pack1;
import [Link];
import [Link];
import [Link];
public class AlertClass5 {
public static void main(String[] args) throws InterruptedException {
//alerts - [Link]/[Link]
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
//alert1
//[Link]([Link]("/html/body/div[1]/div/div/div/div[1]/ul/li[1]/a")).click();
//[Link]([Link]("//*[@id='OKTab']/button")).click();
//[Link](3000);
//[Link]().alert().accept();
//[Link](4000);
//alert2
//[Link]([Link]("/html/body/div[1]/div/div/div/div[1]/ul/li[2]/a")).click();
// [Link]([Link]("//*[@id='CancelTab']/button")).click();
//[Link](5000);
// [Link]().alert().accept(); //accepted
//[Link]().alert().dismiss(); //cancel
//alert3
[Link]([Link]("/html/body/div[1]/div/div/div/div[1]/ul/li[3]/a")).click();
[Link]([Link]("//*[@id='Textbox']/button")).click();
[Link](5000);
[Link]().alert().sendKeys("Testing Selenium");;
[Link](3000);
[Link]().alert().accept();
//[Link]().alert().dismiss(); //cancel
//getting the location,height and width and css value of an element
package Pack1;
import [Link];
import [Link];
import [Link];
import [Link];
public class Class6 {
public static void main(String[] args) throws InterruptedException {
[Link]("[Link]","C:\\Users\\Amit\\Downloads\\Aishwarya\\ge
ckodriver-v0.24.0-win64\\[Link]");
WebDriver driver=new FirefoxDriver();
[Link]("[Link]
//getting the size of the element
WebElement element = [Link]([Link]("email"));
[Link]("the size of the element is : " + [Link]()); //height and
width
[Link]("the location of the element is : " + [Link]()); //x
axis and y axis
[Link]("the css value of the element is : " +
[Link]("background-color")); // background color
Thread .sleep(6000);
//google
[Link]().to("[Link]
WebElement element1 = [Link]([Link]("q"));
[Link]("the size of the google element is : " + [Link]());
//height and width
[Link]("the location of the google element is : " +
[Link]()); //x axis and y axis
[Link]("the css value of the google element is : " +
[Link]("background-color")); // background color
[Link]("the font size of the google element is: " +
[Link]("font-size")); //font size
[Link]("the value of the the google element is:" +
[Link]("name")); //value of the attribute
WebElement element2 = [Link]([Link]("q")); //entering the text in
the search bar
[Link]("yahoo");
[Link](); //submit the text search