Skip to content

Commit

Permalink
JQuery Dropdown fields automation
Browse files Browse the repository at this point in the history
  • Loading branch information
arunmotoori committed Apr 12, 2024
1 parent 200d9a4 commit 9568916
Show file tree
Hide file tree
Showing 14 changed files with 157 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/test/java/doubts/SampleReturnDemo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package doubts;

public class SampleReturnDemo {

public static void main(String[] args) {

add(3,5);

add(10,20);


}

public static void add(int a,int b) {

int sum = a+b;
System.out.println(sum);

}

}
38 changes: 38 additions & 0 deletions src/test/java/doubts/nestedclassesdemo/ClassA.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package doubts.nestedclassesdemo;

public class ClassA {

int a = 10;
static int b = 20;

public void sampleAOne() {
System.out.println("Inside sampleAOne method");
}

public static void sampleATwo() {
System.out.println("Inside sampleATwo method");
}

static class ClassB{

int c = 30;
static int d = 40;

public void sampleBOne() {
System.out.println("Inside sampleBOne method");
System.out.println(b);
ClassA ca = new ClassA();
System.out.println(ca.a);
ca.sampleAOne();
sampleATwo();
}

public static void sampleBTwo() {
System.out.println("Inside sampleBTwo method");
}

}



}
18 changes: 18 additions & 0 deletions src/test/java/doubts/nestedclassesdemo/Demo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package doubts.nestedclassesdemo;

import doubts.nestedclassesdemo.ClassA.ClassB;

public class Demo {

public static void main(String[] args) {

ClassB cb = new ClassB();
System.out.println(cb.c);
System.out.println(ClassB.d);
cb.sampleBOne();
ClassB.sampleBTwo();


}

}
25 changes: 25 additions & 0 deletions src/test/java/jquerydropdowndemo/JQueryDropDownDemoTwo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package jquerydropdowndemo;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class JQueryDropDownDemoTwo {

public static void main(String[] args) {

ChromeDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.jqueryscript.net/demo/Drop-Down-Combo-Tree/");

WebElement singleSelectionDropdown = driver.findElement(By.id("justAnotherInputBox"));
singleSelectionDropdown.click();

WebElement singleChice3Option = driver.findElement(By.xpath("(//span[text()='choice 3'])[3]"));
singleChice3Option.click();



}

}
28 changes: 28 additions & 0 deletions src/test/java/jquerydropdowndemo/JQueryDropdownDemoOne.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package jquerydropdowndemo;

import java.time.Duration;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class JQueryDropdownDemoOne {

public static void main(String[] args) {

ChromeDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));
driver.get("https://www.jqueryscript.net/demo/Drop-Down-Combo-Tree/");

WebElement singleSelectionDropdown = driver.findElement(By.id("justAnotherInputBox"));
singleSelectionDropdown.click();
singleSelectionDropdown.sendKeys("choice 6");

WebElement choice623Option = driver.findElement(By.xpath("//h3[text()='Single Selection']/following::div[3]//li/span[text()='choice 6 2 1']"));
choice623Option.click();


}

}
26 changes: 26 additions & 0 deletions src/test/java/jquerydropdowndemo/JQueryDropdownDemoThree.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package jquerydropdowndemo;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;

public class JQueryDropdownDemoThree {

public static void main(String[] args) {

ChromeDriver driver = new ChromeDriver();
driver.manage().window().maximize();
driver.get("https://www.jqueryscript.net/demo/Drop-Down-Combo-Tree/");

WebElement singleDropdownField = driver.findElement(By.id("justAnotherInputBox"));
singleDropdownField.click();
singleDropdownField.sendKeys("choice 2");
singleDropdownField.sendKeys(Keys.ARROW_DOWN);
singleDropdownField.sendKeys(Keys.ARROW_DOWN);
singleDropdownField.sendKeys(Keys.ARROW_DOWN);
singleDropdownField.sendKeys(Keys.ARROW_DOWN);
singleDropdownField.sendKeys(Keys.ENTER);
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Wed Apr 10 07:21:53 IST 2024
#Fri Apr 12 08:13:52 IST 2024
artifactId=SeleniumFirstProject
groupId=sfp
m2e.projectLocation=C\:\\QAFox\\BatchOne\\SeleniumFirstProject
Expand Down
Binary file added target/test-classes/doubts/SampleReturnDemo.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 9568916

Please sign in to comment.