Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

Selenium Assignment Task1

Please could you find the assignment for Java and Selenium basic assignment.( Every Body need to complete this Assignment and Send back to me )

1.Write a program to Fibonacci series ?
2.Write a program to find the largest of 3 numbers {99,999,456} ?
3.Write a java program, to swap without using 3rd variable?
Given an array int a[] = int a{1,2,2,3,4,4,5,5,6,7}
1. Find the duplicates in the above array and store in to a separate array
2. Find the non duplicates and store in another array.
4.Write a program to reverse a number(eg. 1234 to 4321) without using modulus operator?
5.Write a program n=1238975. Find the biggest integer value in 'N'. [o/p : 9]
6.Write a program : n=16845. O/p will be "n=14568". It should be integer value, It should be in ascending form.
7.Write a program to Reverse a String. Without using any builtin functions like reverse(), charAt()
8.Write a program: Identify and form a string with unique characters. Ex. X=Good Looking. o/p = godlkin.
9.Write a program : Find the repeated words in a given string. example String str="asdf sadf asdf haha sadf sadf test"
10.Write a program : X ="Good Looking"[User input]. Have to find unique characters cout. Should not any duplicate.
For Ex. g - 2; o - 4; d - 1; l - 1; k - 1; i - 1; n-1. [Have to print like this]
11.String s = "I am a wonderful person". Find the number of occurrence of each letters using any programming language.
12.Write a program check if the given(take your self) string is palindrome or not.
13.Write a program Check if the given(take your self) integer is palindrome or not.
14.Write code for reversing the integer? example ::input -0123456789  Output : 9876543210
15.Write program to print number series 111, 222,333,444,555,666,777,888,999 no's..  

To Automate as below scenarios using Selenium ( your code should work chrome ,firefox and ie bowers with fails)
Scenario 1:
Click on Continue button 
Select radio button - holding Driving Licence, Enter DL Number (TextBOX)
Task 1 : print the 'placeholder'attribute value
Task 2 : Enter the value  inthe text box 
Task 3 : print the Entered value 
Task 4 : clear the value again 
Automation : Code snippet shot

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
public class auomate1 {
WebDriver d;
public void open()
{
d=new FirefoxDriver();
d.get("https://parivahan.gov.in/sarathiservice8/newLLDet.do");
d.manage().window().maximize();
}
public void drivinglice() throws InterruptedException
{
d.findElement(By.cssSelector("input[type=button]")).click();
WebElement w1=d.findElement(By.id("licenceType2"));
w1.click();
WebElement w2=d.findElement(By.id("drivingLicenceNo"));
String placehold=w2.getAttribute("placeholder");
System.out.println("Placeholder attribute value >>>>>>>>"+placehold);
w2.sendKeys("MH01 20170001234");
Thread.sleep(3000);
//WebElement w3=d.findElement(By.name("drivingLicenceNo"));
String enteredvalue=w2.getAttribute("value");
System.out.println("value is>>>>"+enteredvalue);
w2.clear();
}
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
auomate1 aut=new auomate1();
aut.open();
aut.drivinglice();
}
}


Scenarios 2: 
Click on Continue button 
button button button on page..
Task 1: Print the Button(Submit,Refresh,Cancel)lable using By.className (btn top-space)

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Scenarios2{
WebDriver d;
public void open()
{
d=new FirefoxDriver();
d.get("https://parivahan.gov.in/sarathiservice8/newLLDet.do");
d.manage().window().maximize();
}
public void button() throws InterruptedException
{

WebElement w1=d.findElement(By.cssSelector("input[type=button]"));
w1.click();
// String s1 = d.findElement(By.className("btn top-space").getText(); 
List s1=d.findElements(By.cssSelector(".btn.top-space"));
Thread.sleep(3000);
String enteredvalue = null;
for (WebElement webElement : s1) {
enteredvalue=webElement.getAttribute("value");
System.out.println("value>>>>>>>>>>>"+enteredvalue);
}




}
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
classname s=new classname();
s.open();
s.button();
}

}

Scenario 3:
Click on Continue button 
Display text  on the screen :: If the LL No: RJ14 /0001234/2017 enter LL number as RJ14/0001234/2017
Task 1 : get the Text and print it 
Task 2 :  "RJ14 /0001234/2017" to extract the String above text
Task  3: split string using '/'


import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Scenario3{
WebDriver d;
public void open()
{
d=new FirefoxDriver();
d.get("https://parivahan.gov.in/sarathiservice8/newLLDet.do");
d.manage().window().maximize();
}
public void text() throws InterruptedException
{
d.findElement(By.cssSelector("input[type=button]")).click();
Thread.sleep(2000);
//WebElement w1=d.findElement(By.tagName("b"));
String w1=d.findElement(By.xpath("/html/body/div/div/div[3]/div/div[2]/form/div[10]/div[2]/b")).getText().substring(9);
System.out.println(w1);
String w2=w1.substring(14, 33);
System.out.println(w2.replace("/",""));
//System.out.println(w1.substring(9));

}
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub

splitstring t1=new splitstring();
t1.open();
t1.text();
}

}

Scenario 4: 
Click on Continue button 
On page there is Date lable ( above search box)
Task 1: To get Text and print date .. every 5min interval...


import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Scenario4{

WebDriver d;
public void open()
{
d=new FirefoxDriver();
d.get("https://parivahan.gov.in/sarathiservice8/newLLDet.do");
d.manage().window().maximize();
}
public void text() throws InterruptedException
{
d.findElement(By.cssSelector("input[type=button]")).click();
Thread.sleep(2000);
//WebElement w1=d.findElement(By.tagName("b"));
String w1=d.findElement(By.xpath("/html/body/div/div/div[3]/div/div[2]/form/div[10]/div[2]/b")).getText().substring(9);
System.out.println(w1);
String w2=w1.substring(14, 33);
System.out.println(w2.replace("/",""));
//System.out.println(w1.substring(9));

}
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub

textprint t1=new textprint();
t1.open();
t1.text();
}

Scenario: 5
Task1 : Count and prinit no of links on the page 
Task2 : Click each and every link on page ,once you get count links
(using logic :: navigate.to (url). and operate browser back and foward button


import java.util.List;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;

public class Scenario5{

WebDriver d;
public void open()
{
d=new FirefoxDriver();
d.get("https://parivahan.gov.in/sarathiservice8/newLL_execute.do");
d.manage().window().maximize();
}
public void linkcount() throws InterruptedException
{
List links=d.findElements(By.tagName("a"));
System.out.println("Total no of links present in the page>>>>"+links.size());
for (WebElement link : links) {
System.out.println("print link text>>>>>"+ link.getText());
Thread.sleep(3000);
link.click();
}
}
public static void main(String[] args) throws InterruptedException {
// TODO Auto-generated method stub
linksprint lp=new linksprint();
lp.open();
lp.linkcount();
}

}

Post a Comment

0 Comments