Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 29

Selenium Automation Testing Demo-------->15685

xpath in selenium--->14014
What are the common Exception you faced in your project?----14394
What is a method in java?----14541
What is a constructor?----14914
this keyword------->15372
What is a class and object in java ?------>15730

103648---->

What are the different element Locators in selenium ?


******************************************************

1. id---------1
2. Name---------2
3. Linktext
4. PartialLinktext
5. TagName
6. ClassName---------3
7. cssSelector
8. Xpath--------4

((JavascriptExecutor) driver).executeScript("window.scrollBy(x-axis,y-axis)");

(javascriptExecutor)driver.executeScript(script,argument);

((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView();",
targetelement);
TestSteps:
************
Open Firefox Browser
Open AppURL In Browser
Get the Title of WebPage
Verify Title of WebPage
Enter the username
Enter the password
Clicking On Login Button
Identify and get the Welcome selenium text
Verify Welcome selenium text

Switch to frame

Handle DropDown in Selenium


****************************
a) How to print all the dropdown values

>First,get the dropdown size

1.First,Identify dropdown
2.Next,Identify all the values from this dropdown

>print all the dropdown values

b) How to Select the dropdown value inside a frame

>Switch to frame
>Identify dropdown
>Select the dropdown value

c) How to verify selected value from dropdown

>get the selected value


>Verify selected value

d) How to Verify dropdown values

Again switch back to main window from frame

Clicking On Logout Button


Close the Firefox Browser

Testing = operation code + verification code


http://register.rediff.com/register/register.php?FormName=user_details

https://www.kosmiktechnologies.com/seleniumLiveProject/kosmik-hms/

>Int datatype can store in the range of values min -2147483648 to max 2147483647

>Long data type can store in the range of values min -9223372036854775808 to max
9223372036854775807
--------------------------------------------------------------------

Button : Login

Html code : <input name=submit>

Selenium code : driver.findElement(By.id("submit")).click();


>How to work with disable textbox or password field. ?

file:///E:/Selenium%20Software%20dump%20files/Browser%20Elements/disabled.html
--------------------------------------------------------------------
//wait 15 sec until the See all element is visible on a webpage once the element is
visible then click on See all link on a webpage

WebDriverWait wait = new WebDriverWait(WebDriverReference,TimeDuration);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.Locator("LocatorValue")
));

until()==>wait for certain amount time until the See all element is visible on a
webpage

visibilityOfElementLocated==>It is used to check that an element is present on the


web page and visible also.

>Float datatype can store in the range of the values min -3.4028235e38F to max
3.4028235e38F

ASCII table

https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html

Imp Points
***********
>Cource Content--->Give me your Email id then I will send you Course Content
>Interview Questions and Answers on Java---->200+
>Interview Questions and Answers on Selenium--->200+
>Resume preparation --->After Course Complete
>Doubts sessions--->Daily
>Weekly Test --->Mon---Sat---->25+
>Job Assistance
>Mainly selenium and Java soft copy =Low level students + Average students + High-
level students

>Selenium Java Training = Java Training +Selenium basic level +Selenium advanced
level+ Selenium Project level +

WhatsApp No : 7386467494
How to scroll to particular / target Webelement using selenium javascript?
****************************************************************

Syntax :
**********

((JavascriptExecutor)
driver).executeScript("arguments[0].scrollIntoView();",targetelement);

>scrollIntoView()==>By using this we can scroll till the target Webelement

Rediff mail
***************

http://register.rediff.com/register/register.php?FormName=user_details

to call instance variable from this keyword ?


************************************************
Syntax :this.variable

How to call default constructor from this keyword?


------------------------------------------
Syntax : this()

How to call the parameterized constructor from this keyword?


------------------------------------------
Syntax : this(value)

How to call method from this keyword?


------------------------------------------
Syntax : this.methodname()
How to call the instance variable from this keyword ?
*****************************************************

Syntax : this.variable

How to call the default constructor from this keyword ?


***********************************************

Syntax : this()

How to call the parameterized constructor from this keyword ?


*************************************************************

Syntax :this(value)

How to call the method from this keyword ?


********************************************

Syntax : this.methodname()

To download Eclipse oxygen,Follow the Url

https://www.eclipse.org/downloads/packages/release/oxygen/3a

Follow the Steps


****************

1.Create Superclass(Animal)
2.Create subclass1(Dog) from Superclass(Animal)
3.Create Subclass2(Cat) from Superclass(Animal)
4.Create Subclass3(Cow) from Superclass(Animal)

Follow the Steps


****************

1.Create Superclass(College)
2.Create subclass1(Principal) from Superclass(College)
3.Create Subclass2(Teacher) from Superclass(College)
4.Create Subclass3(Student) from Superclass(College)

Manual TestSteps:
***************
> Open the firefox browser
> Navigate the application url
> Get the Title of the WebPage
> Print the title of the webpage
> Verify Title of the WebPage
> Enter the username
> Enter the password
> Clicking On Login Button
> Identify and get the Welcome Selenium Text
> Print the Welcome Selenium Text
> To verify whether the welcome page successfully opened or not
> Clicking On Logout Button
> Close the current Firefox Browser

What are the different element Locators to identify the element in selenium ?
******************************************************

1. id----------1
2. Name---------2
3. Linktext
4. PartialLinktext
5. TagName
6. ClassName---------3
7. cssSelector
8. Xpath---------------4

https://www.kosmiktechnologies.com/new-batches/">

https://www.ebay.com/b/PDAs/38331/bn_1638584

Linktext-TestSteps :
********************
>open the Firefox Browser
>Navigate the App Url
> Click on New Batches footer link

Classname
**************
Test Steps :
>open the firefox browser
>navigate the App Url
>Enter Email address into Email or Phone textbox

https://www.kosmiktechnologies.com/new-batches/

https://www.facebook.com/?
min -128 to max 127

What are valid and invalid statements?--IQ


*****************************************

a) byte a=-128;
b) byte b=127;
c) byte c=128;
d) byte d=1.27;
e) byte e="kosmik";
f) byte f=125;
g) byte g=true;

>short data type can store in the range of values min -32768 to max 32767

>min -32768 to max 32767

What are valid and invalid statements?--IQ


*****************************************
short a = -32768;
short b = 32767;
short d = 3.2767;
short e = true;
short f = "Kosmik";

short b = 32768;

What are the integral literal values ?


*****************************************
Ans : byte value,short value,int value,long value

What are the floating-point literal value?


********************************************
Ans : float value and double value

>Int datatype can store in the range of values min -2147483648 to max 2147483647

min -2147483648 to max 2147483647

What are valid and invalid statements?--IQ


*****************************************

int a=-2147483648;

int b=2147483647;

int d=21.47483647;

int e=true;

int g=2147483647L;

int h="Kosmik";
>Long data type can store in the range of values min -9223372036854775808 to max
9223372036854775807

min -9223372036854775808 to max 9223372036854775807

What are valid and invalid statements?--IQ


*****************************************
long a=-9223372036854775808L ;

long b=9223372036854775807L;

long l=100;

long d=92.23372036854775807;

long e=true;

long f="Kosmik";

What are valid and invalid statements?--IQ


*****************************************

boolean a = 0;

boolean b = "true";

boolean c = True;

boolean d = true;

What are valid and invalid statements?--IQ


*****************************************

String str1 = "kosmiktech";

String str2 = "KOSMIKTECH";

String str3 = kosmiktech ;

String str4 = 10;

String str5 = true;

min -3.4028235e38F to max 3.4028235e38F

What are valid and invalid statements?--IQ


*****************************************

float a = 2.356f;

float b = -125.563f;

float d = -101.23;

float f=10.111111111f;

float f = 25f;
float g = 25;//25.0

>Here variable f can store in the range of values min -3.4028235e38F to max
3.4028235e38F

min -1.7976931348623157e308d to max 1.7976931348623157e308D

What are valid and invalid statements?--IQ


*****************************************

double a = 2.356;

double b = -125.563;

double d=10.1111111111111111;//16 1's

double d=10.1111d;

double h = true;
double h = "Hanumanth";

double i= 10.234f; //valid

>Double dataType can store in the range of values

byte(least) < short < int < long < float < double(highest)

char(least) < int < long < float < double(highest)

Note :
----------
Logical And (&&)

F&&F---F
T&&T---T
T&&F---F
F&&T---F

Logical OR (||)

F||F---F
T||T---T
T||F---T
F||T---T

Logical NOT(!)

!False=true
!True=false
---------------------------------------------------------
How to verify multiple checkboxes in a webpage using sselenium?
***********************************************************
Test steps
***********
 Open the firefox browser
 Navigate the AppUrl
 Identify all Checkboxes
 count total checkboxes
 Verify multiple checkboxes one by one
 Close the current Browser window

How to count total checkboxes in a webpage ?


**********************************************
Manual steps
***************
1.Identify all Checkboxes
2.count total checkboxes

Example
*********

List<WebElement> allchk =
driver.findElements(By.xpath("//input[@type='checkbox']"));

System.out.println("Total checkboxes : "+allchk.size());//3

How to Verify multiple checkboxes one by one ?


*************************************************

Manual steps
***************
1.Identify all Checkboxes
2.count total checkboxes
3.Verify multiple checkboxes one by one

Example
*********
List<WebElement> allchk =
driver.findElements(By.xpath("//input[@type='checkbox']"));

System.out.println("Total checkboxes : "+allchk.size());//3

//Verify multiple checkboxes one by one


for(int i=0;i<allchk.size();i++)
{

allchk.get(i).click();

if(allchk.get(i).isSelected())
{
System.out.println("checkbox selected successfully");
}else
{
System.out.println("checkbox not selected successfully");
}
}

Handling popups
*****************
1. How to Handling Web-Based alert Popup/Javascript Alert Popup.
2. How to Handling modal popup window.
3. How to Handling multiple popup windows.

How to Handling Web-Based alert Popup/Javascript Alert Popup.


************************************************************
Manual steps
***************
1.switch to alert box
2.get the alert text
3.click on ok button from alert box

Example
*********

//switch to alert box

Alert alert = driver.switchTo().alert();

String alet_text = alert.getText();

System.out.println(alet_text);//alert text verified successfully

//verify alert text

if(alet_text.equals("alert text verified successfully"))


{
System.out.println("Alert text vcerified successfully");
}else
{
System.out.println("Alert text not vcerified successfully");
}

//click on ok button

alert.accept();

Free Selenium Java Automation Training :

Free Recording Videos and Material:


*********************************
Selenium(Basics + Advanced)

>Material
>Videos
>Interview Questions

Core Java(Basics + Oops concepts + Collections)

>Material
>Videos
>Interview Questions

Who are inetrested plz join in this group :

https://chat.whatsapp.com/JJI9TKM6EcrCqStHw4cWSe

Whatsapp no : 7386467494

2. How to Handle modal popup window.


***************************************
 Open the firefox browser
 Navigate the Application Url
 1.Switch to modal popup window
 2.Do some action
 3.Identify and click on popup window

>Int datatype can store in the range of values min -2147483648 to max 2147483647
What are valid and invalid statements?--IQ
*****************************************
char a = 'd';
char b = d;
char c = "d";
char d = 'dd';
char e = 66;
int f = 'd';

1.Read the property files into the working environment

>Create the Properties object for that config. property file


>Read the config. property file into a working environment
>Store the config.property file in a memory location(a Config reference
variable)

>Create the Properties object for that OR.property file


>Read the OR.property file into the working environment
>Store the OR.property file in a memory location(an OR reference variable)

Handling Frames
*****************
1.How to handle single frame
2.How to handle multiple frames
3.How to handle Nested frames(frame inside a frame)

>Here variable s can store in the range of values min -32768 to max 32767
>Int datatype can store in the range of values min -2147483648 to max 2147483647

>Float datatype can store in the range of the values min -3.4028235e38F to max
3.4028235e38F

((JavascriptExecutor) driver).executeScript(script,argument);

Syntax :

((JavascriptExecutor) driver).executeScript("window.scrollBy(x-pixels,y-pixels)");

((JavascriptExecutor)
driver).executeScript("arguments[0].scrollIntoView();",driver.findElement(By.linkTe
xt("News")));

scrollIntoView() : By using this we can scroll till the target element


Follow ASCII table in java

https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html

Chromedriver.exe
*****************

https://sites.google.com/a/chromium.org/chromedriver/

System.setProperty("webdriver.ie.driver","E:\\Selenium Software dump


files\\Seleniumworkspace\\Seleniumproject\\IEDriverServer.exe");
WebDriver driver = new InternetExplorerDriver();

driver.get("http://127.0.0.1/orangehrm-2.5.0.2/login.php");

Note :
========
Logical And (&&)

F&&F---F
T&&T---T
T&&F---F
F&&T---F

Logical OR (||)

F||F---F
T||T---T
T||F---T
F||T---T

Logical NOT(!)

!False=true
!True=false

Send Email to TestLead


************************
Step 1: Log in to the Jenkins Homepage
Step 2: Install Email Extension Plugin
Step 3: Configure System
Step 4: Create Jenkins Job
Step 5: Send e-mail
Explicit wait:
**************
This will be used only for target element(See all)

Syntax :
*********
//wait 15 sec until the See all element is visible on a webpage once the element is
visible then click on See all link on a webpage

WebDriverWait wait = new WebDriverWait(WebDriverReference,TimeDuration);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.Locator("LocatorValue")
));

https://github.com/mozilla/geckodriver/releases

What are the different element Locators in selenium to identify the


element/object ?--IQ
******************************************************

1. id----1
2. Name---------2
3. Linktext
4. PartialLinktext
5. TagName
6. ClassName-------3
7. cssSelector
8. Xpath----------4

//open the Firefox Browser


System.setProperty("webdriver.gecko.driver","F:\\Seleniumworkspace\\
SeleniumDemoProject\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();

How to call the instance variable from this keyword?


*********************************************************
Syntax : this.variablename
How to call the default constructor from this keyword?
*******************************************************

Syntax : this()

How to call the parameterized constructor from this keyword?


**************************************************************

Syntax :this(value)

How to call the method from this keyword?


*********************************************

Syntax : this.methodname()

Example
*************

short s=32768;//invalid

System.out.println(s);

Code Expla

Ex :
*****
1.Teacher--------100%-------complete knowledge (void teacher(){})
2.Student--------100%-------complete knowledge (void student(){})
3.Chort board----100%-------complete knowledge (void chortboard(){})

4.Fee-------50%---------incomplete knowledge (abstract void fee();)

1.Teacher--------50%-------incomplete knowledge (abstract void teacher();)


2.Student--------50%-------incomplete knowledge (abstract void student();)
3.Chort board----50%-------incomplete knowledge (abstract void chortboard();)
4.Fee-------50%---------incomplete knowledge (abstract void fee();)

@Tes-2
******************
Manual Steps
*****************
1.Read the property files
2.Open the FF
3.Navigate the app URL
----
----

>Create single customergroup


>To verify whether the single customergroup successfully created or not.
>Create multiple customergroups
>To verify whether multiple addcustomergroups successfully created or not
>Click on logout
>close the browser

Selenium Java code


**********************

@Test -3
*************

Manual Steps
*****************
1.Read the property files
2.Open the FF
3.Navigate the app URL
----
----

>Create single customer under kosmik 01


>To verify whether the single customer successfully created or not under kosmik 01.
>Create multiple customers under kosmik 01
>To verify whether multiple addcustomers successfully created or not under kosmik
01

>Click on logout
>close the browser

Selenium Java code


************************

class Superclass
{
@BT
@AT

R.F

}
class Subclass1 extends Superclass
{
@BT
@AT
R.F

@Test 1

class Subclass2 extends Superclass


{
@BT
@AT

R.F

@Test 2

<suite name="Suite" >


<test name="Test">
<classes>
<class name="com.Banking.Customer.Subclass1"/>

<class name="com.Banking.Customer.Subclass2"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->

Output
*********
@BT

@Test 1
@Test 2

@AT

Output
*********
@BC
@Test 1

@AC

@BC

@Test 2

@AC

@BC
@Test 3
@AC

@BC

@Test 4

@AC

String S="Hanumanth";

1.How to convert int type value into string type ?


**************************************************

int x=125;

Syntax : String.valueOf(int type value);

String.valueOf(x);

String.valueOf(125);

"125"

2.CAn we declare a class as a data type ?


********************************************
Ans : Yes

3.Can we enter numeric value into input field(textbox,textarea) by using sendKeys()


?
*************************************************************
Ans : NO

@Tes-3
******************
1.Create single customer under kosmik1
2.To verify whether the single customer successfully created or not under kosmik1.
3.Create multiple customers under kosmik1
4.To verify whether multiple customers successfully created or not under kosmik1.

What is the super, this keywords?

Why we are using super keyword ?


Ans : By using this, we can call the superclass members(variables + methods)
How to call the superclass variable ?
Ans : super.variablename

How to call the superclass method ?


Ans : super.methodname();
Why we are using this keyword ?
Ans : By using this, we can call the current class members(variables + methods)
How to call the current class variable ?
Ans : this.variablename
How to call the currentclass method ?
Ans : this.methodname();

class Test{

@BC
@AC

@Test1
@Test2
@Test3

output
********

@BC

@Test1
@Test2
@Test3

@AC

class Superclass{

@BT
@AT

}
class Subclass1 extends Superclass{

@BT
@AT

@Test1

class Subclass2 extends Superclass{

@BT
@AT

@Test2

----------------------
@BT

@Test1
@Test2

@AT

Output
***********

@BT

@Test1
@Test2
@AT

What is the default package of selenium ?


*********************************************
Ans : org.openqa.selenium

get() :

getTitle() :

How to verify title of the webpage ?


***************************************
Manual Steps
**************
 Get the Title of the WebPage
 Print the title of the webpage
 Verify Title of the WebPage

Testing = operation code + verification code

Selenium Java code


***********************

//operation code

// Get the Title of the WebPage

String title = driver.getTitle();

// Print the title of the webpage

System.out.println(title);//OrangeHRM - New Level of HR Management

//verification code

// Verify Title of the WebPage

if(title.equals("OrangeHRM - New Level of HR Management"))


{
System.out.println("title verified successfully");

}else
{
System.out.println("title not verified successfully");
}

Selenium WebDriver
*********************

>By using this,we can identify element


>After identify the element then do some action on that element

Difference between findElement and FindElements ?


******************************************************
findElement() :

<class name="Packagename.classname">
<methods>
<include name="testMethod"/>
<include name="testMethod"/>
<include name="testMethod"/>
<exclude name="testMethod"/>
</methods>
</class>

Subject : Today’s status on 02-04-2021

Hanumanth lgit <hanumanth.lgit@gmail.com>

Chromedriver.exe
*****************

https://sites.google.com/a/chromium.org/chromedriver/

geckodriver.exe

https://github.com/mozilla/geckodriver/releases

How to download Fire IE Selenium


**********************************

https://code.google.com/archive/p/fire-ie-selenium/downloads

Subject : Today's status on 15-08-2021 10AM

Hi Hanumanth,

Please find below key notes of today's status

Key Notes :

1.Understanding requirements-2hours
2.Prepared the Test cases-2hours
3.Execute the Test cases-2hours
4.Meeting with Project manager-2hours

Please Let me know if you have any Queary

Regards,

Venkat P
Company name
phno
Syntax :
**********

((JavascriptExecutor) driver).executeScript(script,argument);

((JavascriptExecutor) driver).executeScript("window.scrollBy(x-axis-pixels,y-axis-
pixels)");

((JavascriptExecutor)
driver).executeScript("arguments[0].scrollIntoView();",driver.findElement(By.linkTe
xt("News")));

scrollIntoView() : By using this we can scroll till the target element(news)

Data driven framework


*************************

Subject : Today’s status on Inbox module

Hi Rajasekhar,

Please find below key notes of today’s status on Inbox module.

Key Notes :

1.Understanding Requirements : 1hour


2.Prepared 5 Automation Test cases : 3hours
3.Meeting with Project manager : 2hours
4.Work with Opencart Project : 3hours

Let me know if you have any Query

Thanks,

Hanumanth
https://github.com/mozilla/geckodriver/releases

https://chromedriver.chromium.org/downloads

https://www.selenium.dev/downloads/

@FindBys( {
@FindBy(name = "name locator value")
@FindBy(name = "name locator value")
} )List<WebElement> elements;

Hanumanth SeleniumTraining <hanumanthseleniumtraining6@gmail.com>

>min - 128 to max 127

16. What are the valid and Invalid statements ?


**************************************************
a) byte b=125;
b) byte b=-128;
c) byte b=127;
d) byte b=128;
e) byte b=5.8;

f) byte b="Hanumanth";
g) byte b=true;

>min -32768 to max 32767


17. What are the valid and Invalid statements ?
***********************************************
a) short s=-32768;
b) short s=32767;
c) short s=32768;
d) short s=3.2768;
e) short s=true;
f) short s="Kosmik";

min -2147483648 to max 2147483647

18. What are the valid and Invalid statements ?


*****************************************************

a) int i=-2147483648;
b) int i=2147483647;
c) int i=21.47483647;
d) int i=true;
e) int i=2147483647L;
f) int i="Kosmik";

>Long data type can store in the range of values min -9223372036854775808 to max
9223372036854775807

19. What are the valid and Invalid statements ?


**************************************************

a) long l=-9223372036854775808L;
b) long l=9223372036854775807L;
c) long l=92.23372036854775807;
d) long l=true;
e) long l="Kosmik";

23.What are valid and invalid statements?

boolean a = 0;

boolean b = "true";

boolean c = True;

boolean d = true;

24.What are valid and invalid statements?

String str1 = "kosmiktech";

String str2 = "KOSMIKTECH";

String str3 = kosmiktech ;


String str4 = 10;

String str5 = true;

min -3.4028235e38F to max 3.4028235e38F

25.What are valid and invalid statements?

float a = 2.356f;

float b = -125.563f;

float d = -101.23;

float f=10.111111111f;

float f = 25f;

float g = 25;

min -1.7976931348623157e308d to max 1.7976931348623157e308D

26.What are valid and invalid statements?


*****************************************

double a = 2.356;

double b = -125.563;

double d=10.1111111111111111;//16 1's

double d=10.1111d;

double h = true;

double i= 10.234f; valid

Datatype rules
****************

(least)byte < short < int < long < float < double(highest)

Follow ASCII table in java

https://www.cs.cmu.edu/~pattis/15-1XX/common/handouts/ascii.html

(javascriptExecutor)driver.executeScript(script,argument);

Syntax
**********
((JavascriptExecutor) driver).executeScript("window.scrollBy(x-axis,y-axis)");

(javascriptExecutor)driver.executeScript("arguments[0].scrollIntoView();",
Element);

scrollIntoView()==>

Button : login

html code : <input type="Submit" name="Submit" value="Login" class="button"


tabindex="3">

Selenium code : driver.findElement(By.id("Submit")).click();

// Wait 15 sec until the News element is visible on a webpage

WebDriverWait wait= new WebDriverWait(driver, 15);

wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//
span[text()='index.html']")));

You might also like