Python-Introduction

Python Introduction

Python is a pure object oriented language created by guido van rossum. It was released in February 1991. Python is a open source language, you can even add new features to the python source code. It is a beginers language anyone can start coding with python. As it is a interpreter oriented language it executes line by line and interrupts execution at the fisrt error occurence. Python latest version is 3.7

Why Python is so powerful?

  1. Open Source
  2. Broad range of libraries
  3. Portable
  4. Extention
  5. high-level
  6. object oriented language
  7. scalable
  8. interpreted

Application of Python?

  1. Web Application
  2. Scientific and Numeric Computing
  3. Image Processing
  4. Data Science
  5. I, Machine Learning, Deep Learning
  6. Robotics
  7. Game Desigining
  8. I.S

Is python Procedural/Object Oriented language?

            It supports both procedural oriented programming as well as object-oriented programming. As python is developed from different languages, it takes functional oriented features from C language, object-oriented features from C++, scripting from Perl & shell script, Modular programming from module-3 and syntax from C, ABC languages.

             In python, the most common tasks are grouped into functions. Python also consists of a number of predefined functions. So it is considered a procedural oriented programming language.

 Eg:- type(),len(), max(),print()…

 

            On the other hand, everything in python is a class or an object of that class, inheriting the class properties. So python is a object-oriented language.

Eg:- >>> a=10

        >>>type(a)

       <class ‘int’>

      Variables and Datatypes

            Python is a dynamically typed/ type-inferred languages. It means, there is no need  to declare the datatype of a variable before it is used.The variables can be assigned directly with any value. Python interpreter recognises the datatype of the variable based on the value assigned to it. Their is no limit/range for any datatype in python. To know the datatype of a variable, we can use the type () function. 

Eg:-

       >>> s=’supernatural’

      >>> type(s)

      <class ‘str’>

Rules to declare variable/identifiers:

            The names given for function, class and modules is called identifieres. The following rules must follow to declare variable/identifiers are:

  1. It should start with A-Z or a-z or uderscore(_) and can followed by 0-9
  2. Keyword should not be used
  3. Special characters, punctuation marks should not be used

Eg:-

            >>>_a=500 (#valid)

            >>> a  b=500(#invalid)

            >>> 1f=500(#invalid)

            >>>a6gf=500(#valid)

Datatypes:

            In python their are six major datatypes 

  1. Number
  2. String
  3. List
  4. Tuple
  5. Set
  6. Dictionary

Every datatype is a class in python, It contains data and methods. When a variable is initialised with a value the datatype of the variable is automatically detected  and the variable becomes an object of that particular class. It can access the data and method of that class.

These datatypes are divided into two different categories

  1. immutable datatypes
  2. mutable datatypes

Immutable Datatypes:

            Data cannot be modified for immutable datatypes. Numbers,Strings and  Tuples are immutable datatypes

Mutable Datatypes:

            Data can be modified for mutable datatypes. Lists,Sets, and Dictionaries will come under these categories

List

           list is a sequence datatype in python. It is mutable datatype. List is declared by enclosing the elements in sqaure brackets []  and seperated by commas(,). It will support heterogeneous data.

 

>>> L=[1,2,5,7,10]

>>>type(L)

<class ‘list’>

>>>L=[ 5, ‘python’, 4.5, 4+5j, [1,3,5,8]]

List Sclicing:

            The clicing operator [] is used to access the elements of the list using the index of the list. The index of the list start with the zero and ends with len(list)-1.  len()  function returns length of the list.  

>>>L[1]

‘python’

>>>L[4] [1,3,5,8]

            The elements in the list can also be accessed by using the reversed indexing. Reverse indexing start with -1 from the ending of the list to -len(list)

>>>L[-1] [1,3,5,8]

>>>L[-3]

4.5

Range Slicing:

            The range slicing operator [:] is used to access a sublist from the given list [start: end].

The returned sublist starts with the index position start to the index position-1.

 >>> L[0:3] [5, ‘python’, 4.5]

>>>L[-3 : -1] [4.5, (4+5j)]

If starting index postion is not assigned then it will return from the starting of the list to the specified end position.

>>> L[:2]

 [5, ‘python’]

>>>L[-3] [5, ‘python’]

If the ending position is not specified then the list will be returned from the given starting position to the end of the list.

>>>L[2:] [5, ‘python’]

The list L contains string and list as elements the are sequence datatypes. We can access those individual elements also.

>>> L[1][ : -3]

‘pyt’

>>> L[-1][-1]

8

>>>L[-1][-2:] [5, 8]

*Note: List will take three parameters as input one is start, stop and step(optional).

>>> L[ : : -1] [[1, 3, 5, 8], (4+5j), 4.5, ‘python’, 5]

>>> L[0 : 3: -1] []

>>> L[ 3 : 0 : -1] [(4+5j), 4.5, ‘python’]

>>> L[-1 : -5 : -1] [[1, 3, 5, 8], (4+5j), 4.5, ‘python’]

>>>

List Methods:

            By default list class contains some methods we can access these methods by creating list variable. This variable acts as list class object / instance. To access list methods we need call using.

 object_name.method_name()

>>> L=[ 5, ‘python’, 4.5, 4+5j, [1,3,5,8]]  #L is list class object

  1. Append Method:

            append method will add the elements/object to the existing list at last position.

>>> L1=[2,35,6]

>>> L.append(L1) # L1 is other list object

>>> L

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6]]

>>> L.append(‘india’) # directly we can add elements in this way

>>> L

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’]

>>> 

2, Copy Method:

            copy method will copy the element of one list to other list but their reference will be different.

>>> L3=L.copy()

>>> L

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’]

>>> L3

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’]

>>> L.append(‘Jhon’) #if we add new element to list L it will not change in L3 as their reference is differ

>>> L

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’, ‘Jhon’]

>>> L3

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’]

*To check which memory location is pointing by a variable using  id(variable).

>>> id(L)

140081661061832

>>> id(L3)

140081632587016

>>> L2=L #We can directly assign  in this format but it will point to one reference

>>> id(L)

140081661061832

>>> id(L2)

140081661061832

*If any changes performed on list L it will reflect on list L2 also.

>>> L.append(100000)

>>> L

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’, ‘Jhon’, 100000]

>>> L2

[5, ‘python’, 4.5, (4+5j), [1, 3, 5, 8], [2, 35, 6], ‘india’, ‘Jhon’, 100000]

>>>

  1. Count Method:

            if will count how many time particular element is exist in list L

>>> L.count(5)

1

  1. Clear Method:

            clear method will clears the entire list elements

>>>L.clear()

[]

 Extend Method:

            It will extends list by appending elements from the iterable.

>>> L=[1,3,4]

>>> L1=[5,6,1]

>>> L.extend(L1)

>>> L

[1, 3, 4, 5, 6, 1]

      6.Index Method:

            Index method will returns index of the first occurence of  particular element. If element not found in list it will rise an exception.

>>> L.index( 1 )  # element 1 is present in two index postions i.e 0,5

0

>>> L.index(10)         # element 10 is not present in list L

Traceback (most recent call last):

  File “<pyshell#4>”, line 1, in <module>

    L.index(10)

ValueError: 10 is not in list

  1. Insert Method:

            This method will take two parameters, one is index position and other is element. If index is not in range it will place element at the end of the list.

>>> L

[1, 3, 4, 5, 6, 1]

>>> L.insert( 2, 55)

>>> L

[1, 3, 55, 4, 5, 6, 1]

>>> L.insert( 100, 55)

>>> L

[1, 3, 55, 4, 5, 6, 1, 55]

>>> L.insert( -4, 55)

>>> L

[1, 3, 55, 4, 55, 5, 6, 1, 55]

 

  1. Pop Method:

            pop method removes and returns the last item from the list. It takes an optional parameter which is index position of the element and removes from the list.

>>> L.pop()

55

>>> L

[1, 3, 55, 4, 55, 5, 6, 1]

>>> L.pop(2)

55

>>> L

[1, 3, 4, 55, 5, 6, 1]

>>> L.pop(99)  # index 99 doesn’t exists list L

Traceback (most recent call last):

  File “<pyshell#23>”, line 1, in <module>

    L.pop(99)

IndexError: pop index out of range

>>>

9.R emove Method:

            this method take ean lement from the list as an argument and removes the first occurence of that element from the list. It raises an exception if the element is not present in the list.

>>> L

[1, 3, 4, 55, 5, 6, 1]

>>> L.remove( 1 )

>>> L

[3, 4, 55, 5, 6, 1]

>>>

  1. Reverse Method: This method reverses the elements of the list in the place.

>>> L.reverse()

>>> L

[1, 6, 5, 55, 4, 3]

>>>  

  1. Sort Method:

            This method sorts the elements of the list in ascending order if all the elements belong to the same datatype. If elements are of different datatypes, it raises an exception.

>>> L

[1, 6, 5, 55, 4, 3]

>>> L.sort()

>>> L

[1, 3, 4, 5, 6, 55]

>>> L2=[ ‘a’ ,1, 4, 5, 44.0]

>>> L2.sort()

Traceback (most recent call last):

  File “<pyshell#32>”, line 1, in <module>

    L2.sort()

TypeError: unorderable types: int() < str()

 

            It take’s two optional parameters, one is key and other one is reverese. Key parameter takes a function and sorts elements in the list based on that function eg:- len,min,max.

            Reverse parameter takes boolean values True and False, By default this parameter is set to False so elements are sorted in ascending order. If parameter is set to True the elements are sorted in descending order.

 

 >>> L3=[ ‘python’ , ‘java’ , ‘C’ , ‘pascal’ , ‘CPP’ , ‘programming’ ]

>>> L3.sort()

>>> L3

[ ‘C’ , ‘CPP’, ‘java’ , ‘pascal’ , ‘programming’ , ‘python’ ]

>>> L3.sort(reverse=True)

>>> L3

[ ‘python’ , ‘programming’ , ‘pascal’ ,  ‘java’ , ‘CPP’ , ‘C’ ]

>>> L3.sort( key=len, reverse=True)

>>> L3

[ ‘programming’ ,  ‘python’ ,  ‘pascal’,  ‘java’ , ‘CPP’ , ‘C’]

>>>

Software Testing Life Cycle

Software Testing is not considered as a single activity like Do and Close it, but rather it is an ongoing process which never stops (Requirements analysis to test closure, again Requirement Analysis start for new one.) that’s why we consider a sequence of activities (Lifecycle) conducted to perform Software Testing.

software testing life cycle

Points to highlight on STLC process

  • Using certain orders, STLC ensures that the quality standards of an application were met.
  • Each order has its own activities, goals, and deliverables.
  • Each organization follows different phases whereas the basis for STLC remains the same.

In order to understand the orders/phases in details, let’s  consider a real-time example which suits STLC process

Try to build/construct an apartment

Try to build/construct an apartment

For this we have to go through below sequential phases:

Phase 1: Needs/Requirements:

Here will focus on our basic needs to start an apartment, which is very crucial critical analysis.

Action items involved:

  • Type of land
  • Availability of resources like water, ventilation, etc..,
  • Area locality
  • Distance from roads markets educational sectors, offices etc..,

Phase2: Planning

After fulfillment of our needs will plan according to needs

Action items involved :

  • Estimation of human Resources/labor required to complete construction.
  • Amount of materials (concrete cement, sand etc..,)required.
  • Time intervals to complete construction.
  • Blueprint of the apartment.

Phase 3: Designing/Construct:

As per plan, we start to design the building by analyzing the plan.

Action items involved:

  • How many floors, how many flats per floors, how many rooms, dimensions of each room etc..,

Phase 4 : Verify:

Here we will verify the apartment parameters by referring to design/construct.
If actual dimensions of the rooms are not as per design, will do rectification actions and make changes.

Action items:

  • Actual construction will be compared with Design.

Phase 5: Closure activities:

Once all activities complete will happy to go to home

Action items: 

  • We will doesn’t consider how design and verification has been because all are verified correctly and able to see properly constructed home.

similarly, we can describe Software testing life cycle with below phases:

Phase 1: Test Requirement Analysis:

It is an initial phase where Testable Requirements will be analyzed by QA Team which are basic user needs/expectations.

Phase 1 ; Test Requirement Analysis:

Here QA Team builds strong communication Stakeholders (customer, business analyst, technical leads. system architects, user, client, etc..,) to understand the user ideas (requirements) in detail.

Action items:

  • Test priorities and focus of testing.
  • Types of tests like manual or automation will be finalized.
  • Objectives.
  • Goals.
  • Background/History.
  • Functional and Non-Functional Requirements etc..,

Phase 2: Test Planning  

Here higher level people like QA LEAD or QA Manager Will prepare a document which consists of efforts and cost estimates for the project and Complete the test activity.

Test planning

Action items:

  • Prepare Test plan/Test Strategy document.
  • Planning and determining roles and responsibilities of each resource
  • Efforts estimation.
  • Tools used for testing etc…,

Phase 3: Test case/Design development:

Here on seeing the Test plan document, QA Team will Start preparing the Test scenarios, with that, they will write Test casesThese Test scenarios/Test cases will be reviewed by higher level people and approved Test cases will be used to execute the application.

Test case/Design development:

Test scenarios can be both positive and negative checks.

Acton items

  • Prepare Test cases/Test scripts.
  • Test cases/Test scripts review
  • Test Data preparation

Phase 4: Test Execution:

Here QA Team will start executing the application/software (which were migrated from Development team to check) by referring to the written Test Design/Test cases.

 Test Execution:

 

 

 

 

 

If the actual result (from application) doesn’t meet the expected result (from Test cases), then the corresponding test case will be failed. QA Team inform the failed Test case to Developer for correction and test will be carried again after fix from the developer.

Action items:

  • Check application according Test cases.
  • Generate Test results of Test casses to be executed (both pass and fail)
  • Retesting of fixed defects.

Phase 5: Test closure Activities:

Once all Test activities involved in the Test process completes.QA Team will prepare a Test report which shows the Test results by referring to a number of Test cases Written, number of “No Run” Test cases, number of Test cases” passed” (which were passed after fix) etc..,

Test closure Activities:

Basic names for test reports are:

Test summary report.
Test execution Report.
Test status Report.
Test post morten Report.
Action items:
Test Analysis report.
Test final report.

Java-Programs-asked-in-Selenium-Interview

1. How to Print List of Even Numbers in Java?

 package JavaPrograms_InterviewQuestions;

 import java.util.Scanner;

 public class PrintEvenNumbers {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Limit:”);

int value = sc.nextInt();

System.out.println(“Print Even numbers between 1 and ” + value);

for (int j = 1; j <= value; j++) {

// if the number is divisible by 2 then it is even

if (j % 2 == 0) {

System.out.print(j + ” “);

}

}

}

}

Output :

Enter Limit:

40

Print Even numbers between 1 and 40

2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 40

2.How to Compare Two Numbers In Java ?

 package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

public class CompareTwoNumbersInJava {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Number 1: “);

int num1 = sc.nextInt();

System.out.println(“Enter Number 2: “);

int num2 = sc.nextInt();

if (num1 > num2) {

System.out.println(num1 + ” is greater than ” + num2);

} else if (num1 < num2) {

System.out.println(num1 + ” is less than ” + num2);

} else {

System.out.println(num1 + ” is equal to ” + num2);

}

}

}

Output :

Enter Number 1:

14

Enter Number 2:

12

14 is greater than 12

3.Access Modifiers in Java ?

package JavaPrograms_InterviewQuestions;

public class Java_AccessModifier {

public int a = 10;

protected int b = 20;

private int c = 30;

int d = 40;

public void test1() {

System.out.println(“public test1()”);

}

protected void test2() {

System.out.println(“protected  test2()”);

}

void test3() {

System.out.println(“void test3()”);

}

private void test4() {

System.out.println(“private  test4()”);

}

public static void main(String[] args) {

Java_AccessModifier obj = new Java_AccessModifier();

obj.test1();

obj.test2();

obj.test3();

obj.test4();

System.out.println(obj.a);

System.out.println(obj.b);

System.out.println(obj.c);

System.out.println(obj.d);

}

}

Output :

public test1()

protected  test2()

void test3()

private  test4()

10

20

30

40

HOW TO HANDLE FRAME IN SELENIUM WEBDRIVER USING JAVA?

4.Verify Year is Leap Year or Not in Java ?

package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

public class VerifyLeapYear {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Year: “);

int year = sc.nextInt();

// if year is divisible by 4, it is a leap year

if ((year % 400 == 0) || ((year % 4 == 0) && (year % 100 != 0))) {

System.out.println(“Year ” + year + ” is a leap year”);

} else {

System.out.println(“Year ” + year + ” is not a leap year”);

}

}

}

 

Note: Every fourth year is Leap Year.

Output :

Enter Year:

2008

Year 2008 is a leap year

 

5. To verify whether the no is palindrome or not in java?

package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

class VerifyPalindrome {

public static void main(String args[]) {

int r, sum = 0, temp;

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Number to Check Palindrome or Not:”);

int n = sc.nextInt();

temp = n;

while (n > 0) {

r = n % 10;

sum = (sum * 10) + r;

n = n / 10;

}

if (temp == sum) {

System.out.println(“Given Number is Palindrome”);

} else {

System.out.println(“Given Number is Not Palindrome “);

}

}

}

 

Note: A palindromic number or numeral palindrome is a number that remains the same when its digits are reversed.

 

Output :

Enter Number to Check Palindrome or Not:

5

Given Number is Palindrome

STEPS TO CONFIGURE SELENIUM WEBDRIVER WITH JAVA TO DEVELOP TEST SCRIPTS

6. Find Factorial of a Number in Java?

package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

public class FactorialNumber {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Number: “);

int value = sc.nextInt();

int factorial = value;

for (int a = (value – 1); a > 1; a–) {

factorial = factorial * a;

}

System.out.println(“Factorial of number is ” + factorial);

}

}

 

Note : factorial of number 4!= 4*3*2*1=24.

Output :

Enter Number:

4

Factorial of number is 24

7.H ow to Display Fibonacci Series in java?

 

package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

public class FibonacciSeries {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Number for Fibonacci series :”);

int n = sc.nextInt();

int t1 = 0, t2 = 1;

System.out.print(“First ” + n + ” terms: “);

for (int i = 1; i <= n; ++i) {

System.out.print(t1 + ” , “);

int sum = t1 + t2;

t1 = t2;

t2 = sum;

}

}

}

 

Output :

Enter Number for Fibonacci series :

10

First 10 terms: 0 , 1 , 1 , 2 , 3 , 5 , 8 , 13 , 21 , 34 ,

8. To Check Whether a Number is Prime or Not in java?

 package JavaPrograms_InterviewQuestions;

import java.util.Scanner;

public class PrimeNumber {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

System.out.println(“Enter Prime Number: “);

int num = sc.nextInt();

boolean flag = false;

for(int i = 2; i <= num/2; ++i)

{

// condition for nonprime number

if(num % i == 0)

{

flag = true;

break;

}

}

if (!flag)

System.out.println(num + ” is a prime number.”);

else

System.out.println(num + ” is not a prime number.”);

}

}

 

Output :

Enter Prime Number:

29

29 is a prime number.

 

 

 

How to verify single checkbox in a webpage using selenium?

TestSteps

  • Open the Firefox browser
  • Navigate the AppUrl
  • Identify Checkbox1
  • Select Checkbox1
  • Verify Checkbox1
  • Close the current Browser window

Selenium Code :

——————–

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

 

public class VerifyCheckbox {

public static void main(String[] args) {

  //open the firefox browser

WebDriver Driver = new FirefoxDriver();

  //navigate the AppUrl

Driver.get(“http://demo.guru99.com/test/radio.html”);

// Identify Checkbox1

WebElement CheckBox1= Driver.findElement(By.id(“vfb-6-0”));

//Select Checkbox1

CheckBox1.click();

   //Verify Checkbox1

if (CheckBox1.isSelected())

{

System.out.println(“Checkbox1 Selected”);

} else

{

System.out.println(“Checkbox1 not Selected”);

}

  //Close the current Browser window

Driver.close();

}

}

How to verify multiple checkboxes in a webpage using sselenium?

TestSteps :

  • Open the firefox browser
  • Navigate the AppUrl
  • Identify all Checkboxes and store into checkBoxes variable
  • Print the total checkboxes
  • Select multiple checkboxes one by one
  • Verify multiple checkboxes one by one
  • Close the current Browser window

 Selenium Code :

——————–

package seleniumProject;

import java.util.List;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.firefox.FirefoxDriver;

public class Verify_Multiple_Checkboxes {

public static void main(String[] args) {

       //open the firefox browser

WebDriver driver = new FirefoxDriver();

  //navigate the AppUrl

driver.get(“http://demo.guru99.com/test/radio.html”)

     // Identify all Checkboxes and store into checkBoxes variable

List<WebElement> checkBoxes = driver.findElements(By.xpath(“//input[@type=’checkbox’]”));

   //print the total checkboxes

System.out.println(checkBoxes.size());

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

{

  //select multiple checkboxes one by one

checkBoxes.get(i).click();

       //verify multiple checkboxes one by one

if(checkBoxes.get(i).isSelected())

{

System.out.println(i+” checkBox is selected “);

}else{

System.out.println(i+” checkBox is not selected “);

}

}

  //Close the current Browser window  

driver.close();

}

}

SELENIUM | BROWSER COMMANDS :

isSelected(): By using this we can verify particular checkbox is selected or not on a webpage.

 

Click here: Steps to configure Selenium WebDriver with java to develop test scripts

Click here: How to handle frame in selenium webdriver using java?

Selenium Training in Hyderabad

Kosmik Technologies is on of the best selenium training in Hyderabad. We are providing lab facilities with complete real-time training. Training is based on complete advance concepts. So that you can get easily “hands-on experience”. We will give 100% job assistance.

 

Manual testing interview questions
Manual testing interview questions
1) Difference between Regression and retesting?
 
Retesting:
 
When QA identified a defect, then it should be assign it to Developer. Once developer gives fix, then there should be retesting done to confirm defect has been removed or not. This we call RETESTING”. Retesting will done before regression.
 
Regression:
If any new code added to the application (New CR and Defected fixed code), ensure this new code doesn’t impact on other components of the system. Regression will done after retesting.
 
2) What are different phases in agile process?
 
Agile is very powerful SDLC methodology to implement software in a better manner.
 
  • Sprint planning.
  • Sprint meeting.
  • Sprint product demonstration.
  • Sprint Retrospective.
 3) Who Will prepare RTM(Requirement Traceability Matrix)
 
Requirement Traceability Matrix will ensure 100% test coverage. Which means every test case should be mapped to their corresponding Requirement. In an organization, QA Manager will prepare Requirement Traceability Matrix
  
4) Define Defect Life Cycle with defect status?
 
Defect life cycle starts with when defect found and when it successfully closed(also Known as Bug Life Cycle). In this defect undergoes different status, Which described below.
 
  • New: When QA member finds the defect.
  •  Open: Once QA lead/Manager review defect and change it status to open and assign it to Developer.
  •  Fixed/ Retest: Once defect got fixed from Developer and assign it to QA member.
  •  Re-OPenedIssue after retesting the defect. In this member assign defect to Developer again.
  •  Rejected: There will be two reasons to reject defect from Developer.
  •  Duplicate Defect: Same defect has been raised by another QA member
  •  Not a Defect: Raised defect is not related to Requirement.
  •  Deferred: Fix will be given in further phases.
  •  Closed: Once the retested defect meets user requirement, QA member will close the defect.
 5) Where Test cases will be written in QC?
 
Test cases design will be done in Test Plan.
 
6) Where Test cases will be executed?
 
When tested application is migrated to QA Environment, then Test cases corresponding application will be pulled to Test lab and will be executed.
 
7. Name different requirement documents?
 
  • SRS(System requirement specification)
  • BRD (Business requirement document)
  • TRD (Technical Review document)
  • User Manuals.
  • Use cases
  • User stories(only in agile)
 8. What is meant by test scenario and test case?
 
Test scenario is “what to be tested and test case “How to be tested”. Test scenario is simply one liner statement Which explains about What to test. Whereas Test case gives detailed information about Pre-condition. What to test ,test description, design steps and expected results.
 
9. At What condition automation is preferred?
 
After completion of manual testing (application is in Stable), if any regression/repeated test cases going to execute, in that case Automation is preferred.
 
10) System and E2E testing levels will fall into what method?
 
System and E2E will come into Black Box Testing
 
11) What is meant by alpha and beta testing?
 
In Alpha, Application/Software is under Developer environment. Here we will shows case the application as per the user requirements.
 
Where in Beta, Application/Software is under user environment and Developer will send only few feedbacks to support UAT.
 
12) Name the roles and responsibilities of product owner in Agile?
 
Roles for product owner are:
 
He/She prioritize the Sprint duration.
 
He/She prioritize the User stories for the particular Sprint.
 
13) What things do we discuss in Retrospective meeting in Agile?
 
      Below things are discussed in Retrospective meetings.
 
  • Things went well.
  • Things not went well
  • Things need to be updated.
14) Name few SDLC types
 
SDLC types:
 
  • Water fall.
  • V-Model.
  •  Iterative.
  •  Spiral.
  •  Big bang.
  •  Agile etc.
15) Name types of integration testing?
 
  • Top- Bottom Approach.
  •  Bottom- Up Approach.
  •  Sandwich Approach.
  •  Big Bang Approach.

What is testing tools?

Before knowing Software testing, we need to know what is meant by the word “TEST”.

In real world, we see TEST as

  • Test exam: Conducting an exam to check the students percentage of pass/fail.

Action items: As per the questions given, students answer to the corresponding questions (which means every question should have expected answers.)

  • Test Lab Reports: Here as per the sample given, will go a process of treatment as per the reports.

Action Items: As per the reports will contact doctor and do the corrective actions.

  • Test Drive: Here will check performance (speed, mileage, engine pickup, etc…,) of the driven vehicle.

Action Items: Here we will check whether the vehicle is as per our requirements or not.

  • Test Match: Everyone knows what is meant by Test Cricket, where we mainly focuses on player performance like stamina, sustain, resistance, patience etc…,

Action Items: Player will be IN the team if his/her performance is good.

Now derive, definition of Software Testing from real-time examples:

Software testing is a process of identifying the issues and do the corrective actions and provide quality product of an application/product/software.

Aim: Is to focus on user requirements, needs and expectations of the user/customer.

Job: To find the failures in the application and do the corrective actions as per user needs.

Testing Tools Training in Hyderabad

Testing Tools:

For doing testing in this advanced world, we will use some testing tools in order to fasten the work, bring system into stable, check in multiple applications simultaneously, provide continues reports to user for easy to understand, etc…,

Some of the well-known testing in market are:

  1. TestComplete
  2. Selenium
  3. LeanFT
  4. Tosca
  5. UFT
  6. Rational Functional Tester

 

testing tools in market

 

Automation tools:

Nowadays, development pactices changes frequently and many updates are proposed which aims to provide quality, customer expectations, productivity etc…, and the same should be happen when comes to test automation.

The main Automation tools available in current market are:

  1. UFT
  2. Selenium
  3. Katalon Studio
  4. TestComplete
  5. Rational Software etc…,

 

Automation Testing

Automation Tools

What is meant by Manual Testing?

Basically Software Testing is divided into two types:

  1. Manual Testing
  2. Automation Testing

Manual Testing vs Automation Testing

Manual Testing will be defined as:

Software testing where QA team manually executes written Test cases without any automation involved will be considered it as Manual Testing.

Aim of Manual Testing to find/identify the bugs/defects in the application/product/software using written Test cases and focus on delivery quality application / product / software which meets ccustomer/userneeds.

Manual Testing

indepths of Manual Testing

Why Manual Testing needed?

  • Whatever we expect should come:

Example: When we try to launch https://www.gmail.com login page, it should show me the same, but if it opens https://www.yahoomail.com which is not as expected. Hence there should be a team (QA) to check whatever user needs should come.

Why manual Testing

  • Application behavior varies from one to many users, so it should work as expected when deals with one to many:

Example: Generally we have noticed server slow / down when we try to book railway tickets at Tatkal timings and as well as when server publish exam result. This is mainly due to load on the server. So there should be a team (QA) to check the server performance with one to many user.

  • Application in different places should work without any dependency:

 

Example: # Many people uses different devices like IPhone, Moto, Samsung, MI etc…,

    # Not only this, people uses many browsers like Mozilla, Chrome, IE, Safari etc…,

    #adding to this, many people uses many Operating Systems like Windows, Linux, MAC, Android, IOS etc…,

Hence application should behave same irrespective of devices / Browsers / Operating Systems which means a team (QA) should require to support this checks.

Manual Vs Automation:

As the name Manual suggests, executing the application with respect to written Test Cases. And for Automation, will execute the application with respect to written Test scripts. However we have many difference between Manual and Automation.

Manual

  • Investment required as human are involved.
  • Time Consuming.
  • Less reliable, not accurate due to human errors.
  • Suitable at Exploratory Testing, Usability Testing and Ad-hoc testing.

Automation

  • Investment required on automation tools.
  • It will be faster than manual.
  • More reliable as Automation tools involve.
  • Suitable at regression testing, Load Testing, repeated testing and performance testing.

Manual Testing vs Automation testing

Software Testing Life cycle(STLC):

As a basic example, a human life will start as Infant, later goes through distinct ages to gradually grow and matured to grand age. Similarly, Software Testing Life Cycle has different phases to go though and gives us a Quality Product.

Phases:

  1. Test Requirement ANalysis.
  2. Test planning.
  3. Test case Design and Development.
  4. Test Environment Setup.
  5. Test Execution.
  6. Test Closure.
Software Development Life Cycle(SDLC):

Software Development Life Cycle involves entire product members to design, develop and gives the quality product as per the customer needs.

It is a conceptual and long-term view of software product to be delivered.

Types of SDLC models in real market:
  1. Waterfall Model.
  2. V-Model.
  3. Iterative Model.
  4. Spiral Model.
  5. Big-Band Model.
  6. AGILE Model etc…,

Manual testing interview questions and Answers

Testing Tools training in Hyderabad

Kosmik Provides Testing Tools training in Hyderabad(ClassRoom & Online). We are providing lab facilities with complete real-time training. Training is based on complete advance concepts. So that you can get easily “hands-on experience”. We will give 100% job assistance.

Android Basic Interview Questions

android basic interview questions

Android Developer Interview Questions

1.What is android?

 Android is open source Linux based operating system with middle ware and some key applications

2.What are the advantages of android?

Open-source:

It means no licence, distribution and development fee.

Platform-independent: 

Android is platform independent we can develop applications in mac, Linux and windows also by using android studio

Supports various technologies:

It supports camera, Bluetooth, WiFi, speech, EDGE etc. technologies.

DVM :

DVM is highly optimized virtual machine which will convert to .dex file

3.What is an Activity?

Activity is like a frame or window in java that represents GUI. It represents one screen of android.

4.What is Activity life cycle?

There are 7 life-cycle methods of activity. They are as follows:

  1. onCreate() — called when activity is first created.
  2. onStart() — onStatrt will invoked  when activity is becoming visible to the user.
  3. onResume() — onResume will invoked when activity will start interacting with the user.
  4. onPause() onPause will invoked when activity is not visible to the user.
  5. onStop() — onStop will invoked if activity is no longer visible to the user.
  6. onRestart() — onRestart will invoked if your activity is stopped and prior to start.
  7. onDestroy() — onDestroy will invoked before the activity is destroyed

5.What is the difference between margin and padding?

if you want to take your widget like TextView, EditText far away from other. You should use margin from top,right,left,bottom.

By giving padding the component size will be increased  

6.What is the difference between gravity and layout_gravity?

android:gravity Is to specify to place content with in the object.if gravity is left means object content is going to be left to the component.

android:layout_gravity is an attribution the child can supply to its parent, to specify the gravity the view within its parents

7.What is APK?

APK means Android Package Kit.android is going to make apk file with all resources and code to install on mobile phone

8.What DVM and difference between DVM and JVM?

DVM means Dalvik Virtual Machine

DVM is Register based and specially designed to run on low memory

uses its own byte code and runs .Dex file

JVM is Stack based and convert all java code to .class files

9.What is AndroidManifest.xml?

Every application must have an AndroidManifest.xml file (with precisely that name) in its root directory.We will register every activity ,services,broadcast receivers and content providers.We will declare all permissions in manifest file only.

10.What is a service in android?

Service is a background process that can run for a long time even after closing activity also.

11.What is Content Provider?

Content Providers are used to share data between the applications.

12.What is Broadcast Receiver?

A broadcast receiver (receiver) is an Android component it allows you to register for system events Like calls, notifications. Once we register a receiver, automatically receiver is going to call once that functionality is triggered.

 

1. What is default package of selenium?
2. Maximizing Browser Window?
3. What are the prerequisites to run selenium webdriver?
4. What are the flavors of selenium ?
5. Diff b/w Verify and Assert ?
6. How to Verify Element is visible or not?
7. Verify Single checkbox is selected or Not ?
8. Verify Multiple checkboxes are selected or Not ?
9. How to handle Popup window ?
10. How to perform double click in selenium?
11. How to select dropdown value inside a frame?
12. How to get all the frames on webpage ?
13. How Switch back to Main page from Frame ?
14. Suppose I have two submit buttons with same names on Webpage, here how can u click on 1st submit button.
15. How to scroll webpage to particular WebElement ?
16. How to read and verify Font Properties?
17. Diff b/w cssSelector and xpath ?
18. How to verify particular text in a webpage ?
19. Diff b/w driver.getwindowhandle() and driver.getwindowhandles()?
20. Which Programming Languages Supported By Selenium WebDriver To Write Test Cases?
21. Which Different Element Locators Supported By Selenium WebDriver?
22. What Is XPath and what Is use of It In WebDriver?
23. Which tool you are using to find the XPath of any element?
24. Can you tell me a difference between driver.get() and driver.navigate() methods?
25. Which Programming Languages Supported By Selenium WebDriver To Write Test Cases?
26. What Is XPath and what Is use of It In WebDriver?
27. How to handle Web Based Popups?
28. How to handle single Popup window ?
29. Can we automate desktop software application’s testing using selenium WebDriver?
30. Can we perform drag and drop operation In Selenium WebDriver?
31. How to verify successful message in a webpage ?
32. How do you identify the Xpath of element on your browser ?
33. What is the difference between absolute XPath and relative XPath?
34. How to Create customized xpath in selenium ?
35. How To Handle Dynamic Changing IDs In XPath. ?

Example :
Xpath= //div[@id=’post-body-3647323225296998740′]/div[1]/form[1]/input[1]

In this XPath “3647323225296998740” Is changing every time when reloading the page. How to handle this situation?

36. Tell me a reason behind bellow given WebDriver exception and how will you resolve It?

“Exception in thread “main” org.openqa.selenium.NoSuchElementException: Unable to locate element”

37. Can you tell me a syntax to close current webdriver Instance and to close all opened webdriver Instances?
38. What Is the syntax to get value from text box and store It In variable. ?
39. How to capture screenshot when test case failure In selenium webdriver ?
40. Tell me any 5 webdriver common exceptions which you faced during software test case execution. ?
41. What is Difference between getAttribute() and getText()?
42. To verify whether the particular text is present or not on the page ?
43. Why need Ant-XSLT-Reports in selenium WebDriver. ?
44. What is a framework and Advantages of framework. ?
45. How to Login with Excel ?Write selenium Code. ?
46. How to verify dropdown values using Excel in selenium WebDriver. Write selenium Code. ?
47. How to run Multiple test cases from Testng.xml file. Write selenium Code. ?
48. For ex I have 3 columns from webTable .How to print the 2 column data from webtable. ?
49. Difference between selenium and qtp ?
50. Tell me about the brief introduction of selenium ?
51. Does selenium support mobile application testing ?
52. Can client server application can be automate through the selenium ?
53. which type of testing we are doing by using selenium ?
54. what are the limitations of selenium ide or selenium webdriver ?
55. How to identify webelement in selenium ?
56. when we will go for xpath in selenium ?
57. I want to run my application into firefox browser. How you handle it ?
58. what is the difference between id and name in selenium ?
59. How to handle dynamic objects in selenium ?
60. what are the locators available in selenium ?
61. what is the default timeout for selenium ?
62. When do we use implicit and explicit in selenium ?
63. How to handle ajax application in selenium webdriver ?
64. How to handle multiple Popup windows in selenium webdriver ?
65. Difference between findelement() and findelements() in selenium ?
66. How to handle the Expected alerts in webdriver ?
67. How to handle the UnExpected alerts in webdriver ?
68. My web page contain calendar, how to write script for calendar date selection ?
69. My checkbox would be in checked position, how can you say checkbox would be in check position ?
70. My login page contain captcha explain how to write script ?
71. How to run eclipse script from cmd prompt by Ant ?
72. How to execute same script in different browsers ?
73. what is isdisplayed in selenium ?
74. what is difference between iselementpresent and isdisplayed ?
75. Can you test flash images in selenium ?
76. How do you verify an object presented in multiple pages in selenium ?
77. How to select the dropdown values in selenium ?
78. Does selenium support https protocols ?
79. How to get the third column data from Table ?
80. Per day how many scripts your writing and executing ?
81. Tell me difficulty’s in your project faced by you ?
82. which driver implementation will allow headless mode ?
83. How to perform drag and drop operation in selenium webdriver ?
84. How many frameworks are there .which to use.how will you deside that ?

85. what is page object model in selenium ?
86. what framework your using can you explain the framework ?
87. what are the challenges did you faced while automating the application ?
88. Explain your Roles and Responsibilities in your project ?
89. How to connect selenium to database ?
90. which tool did you use for reporting ?
91. why did you choose selenium in your project where we are having so many tesing tools ?
92. what is difference between javascript and javaprogram ?
93. Why should we go for javascript in selenium ?
94. What is the alternate way to send text into textbox of webpage with out using sendKeys() method ?
95. If any button is hidden/disabled then how to click on button using selenium ?
96. send one empty mail from your official mail id ?
97. How to login into any site if its showing any authentication popup for user name and pass ?
98. How do you launch IE/chrome browser?
99. How to perform right click using WebDriver?
100. How do you simulate browser back , forward and refresh?
101. What is the difference between ‘/’ and ‘//’ ?
102. How do you handle https website in selenium
103. What is the use of AutoIt tool ?
104. How to count the number of checkboxes checked in selenium webdriver ? or How to select multiple check box and verify ?

TestNg :
———–

105. What is TestNg ?What is the use.?
106. What is Annotation ? How many Annotations are there in TestNg ?
107. what are the different assertions or check points used in your script?
108. Can we run group of test cases using TestNG ?
109. I have 50 testcases Here i want to execute only 3 test cases without using testng groups?
110. How to run only failure test cases in testNg ?
111. What is the difference between before method and before class ?
112. What is Data provider ?
113. What is return type of Data provider ?
114. Difference between junit and TestNg ?
115. How to handle ajax application in selenium webdriver ?
116. How to capture the bitmaps in selenium ?How to capture screenshot in selenium webdriver ?
117. How to read the methods/functions from xml/xls files ?
118. What is the difference between include and exclude in selenium ?
119. How to execute single selected method in testng ?
120. what is the difference between packages and classes in Testng?
121. what is the difference between verify and assert command ?
122. what we go for Assertions ?What is Assertions?
123. Tell me login page script in testng?
124. what is difference between @parameters and @data provider in testng ?
125. Is it possible to write to multiple test cases in single class ?
126. Which problems are faced in Testng ?
127. How to create test suites in testng ?
128. what is the library file of testng ?
129. How to read and write the data from Excel file using apache poi.
130. What Is TestNG And use of testNg?
131. What Is the usage of testng.xml file?
132. What is the command used inside the .bat file to run the testng.xml fille ?

133. What is the command line we have to write inside a .bat file to execute a selenium project when we are using testng ?
134. TestNg i have some tests line

@test1
@test2
@test3
@test4
@test5

I want to run my execution order is
@test5
@test2
@test1
@test4
@test3

What is a frame?

Frame is just like as a container where few elements can be grouped.

How to identify frame inside a webpage?

There are different ways to identify frame inside a webpage

Way 1:

  • Open webpage in a browser.

webelement in a webpage

  • Right click on webelement in a webpage

frame inside a webpage

Way 2:

  • Open webpage in a browser.
  • Right click on webelement in a webpage
  • Open source code(Html Code) of the webpage by clicking inspect element with firebug option see below image.

iframe source code

How to handle an element inside the frame?

There are 4 ways to handles frames in selenium webdriver.

Switch to frame by using index :

Method 1 :

Suppose if there is single frame in a webpage then we can switch to the iframe by using index.

Here is the sample code:

Syntax : driver.switchTo().frame(int index);

Example : driver.switchTo().frame(0);

Note : By default single frame index value ‘ 0’.That means when webpage has  only one frame then the index will be zero.

Method 2 :

Suppose if there are 3 frames in a webpage then we can switch to the iframe by using index.

Here is the sample code:

Syntax :

List<WebElement> framelist=driver.findElements(By.tagName(“iframe”));

driver.switchTo().frame(framelist.get(int index));

Example :

List<WebElement> framelist=driver.findElements(By.tagName(“iframe”));

//switchTo 1st frame by using index

driver.switchTo().frame(framelist.get(0));

  //switchTo 2nd frame by using index

driver.switchTo().frame(framelist.get(1));

//switchTo 3rd frame by using index

driver.switchTo().frame(framelist.get(2));

Switch to frame by using Id or Name :

We can also use Name and Id attributes of iframe  through which we can switch to iframes.

Here is the sample code:

Syntax 1:

driver.switchTo().frame(“Id of  the element”);

Html code :

iframe html code

                                                                                  Example : driver.switchTo().frame(“rightMenu”);

Syntax 2:

driver.switchTo().frame(“Name of  the element”);

Html code :

iframe html code

                                                                              Example : driver.switchTo().frame(“rightMenu”);

Switch to frame by using WebElement :

We can also switch to the frame using webelement.

Here is the sample code:

Syntax :

driver.switchTo().frame(WebElement);

Html code :

iframe html code

Example : driver.switchTo().frame(driver.findElement(By.name(“rightMenu”)));

How to get all the frames in a webpage ?

get all the frames in a webpage

Html code :

Open notepad and type the below Html code and save as frames.html

<html>

<body>

<iframe src=”http://www.seleniumhq.org/download/” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

 

<iframe src=”http://127.0.0.1/orangehrm-2.5.0.2/login.php” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

<br>

<iframe src=”http://testng.org/doc/index.html” width=”200″ height=”200″ name=”selenium”>

<p>Your browser does not support iframes.<p>

</iframe>

<br>

<a class=”gb_P” data-ved=”0EMIuCBMoAA” href=”https://mail.google.com/mail/?tab=wm” data-pid=”23″>Click on Gmail</a>

</body>

</html>

 

Example :

package seleniumProject;

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 getTotalFrames {

public static void main(String[] args) {

//   Open Firefox Browser  

       WebDriver driver = new FirefoxDriver();

 //   Open AppURL In Browser

driver.get(“file:///C:/Users/Hanumanthu/Downloads/frames.html”);

 // count all the frames on a webpage

List<WebElement> total_frames=driver.findElements(By.tagName(“iframe”));

System.out.println(total_frames.size());

//close the current browser window

driver.close();

}

}

How to verify TestNg text inside 3rd frame?

verify TestNg text inside 3rd frame

Selenium Sample Code :

package seleniumProject;

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 getTotalFrames {

public static void main(String[] args) {

   // Open Firefox Browser  

WebDriver driver = new FirefoxDriver();

//  Open AppURL In Browser

driver.get(“file:///C:/Users/Hanumanthu/Downloads/frames.html”);

 //count all the frames on a webpage

List<WebElement> total_frames=driver.findElements(By.tagName(“iframe”));

System.out.println(total_frames.size());

 //Switch to 3rd Frame by using Index

driver.switchTo().frame(total_frames.get(2));

  //Identify and get the text and store into testNg_text variable

String testNg_text=driver.findElement(By.xpath(“html/body/h2[1]”)).getText();

   //print the text from 3rd frame

System.out.println(testNg_text);

  //verify the text from 3rd frame

if(testNg_text.equals(“TestNG”))

{

System.out.println(“TestNG text verified successfully”);

}else

{

System.out.println(“TestNG text not verified successfully”);

}

 //How switch back to main window from inside any frame ?

driver.switchTo().defaultContent();

//Close the Firefox Browser

driver.close();

}

}

Note :

switch back to main window from inside any frame

1. Switch to 3rd Frame by using Index

Syntax :   driver.switchTo().frame(total_frames.get(index));

Example :   driver.switchTo().frame(total_frames.get(2));

2.Switch to 3rd  Frame by using Id

Syntax :   driver.switchTo().frame(“Id of the element”);

Example :   driver.switchTo().frame(“selenium”);

If no id then go for Name.

 3.Switch to 3rd  Frame by using Name

Syntax :   driver.switchTo().frame(“Name of the element”);

Example :   driver.switchTo().frame(“selenium”);

4.Switch to 3rd  Frame by using WebElement

Syntax :   driver.switchTo().frame(WebElement);

Example :   driver.switchTo().frame(driver.findElement(By.name(“selenium”);

 How switch back to main window from inside any frame ?

Syntax : driver.switchTo().defaultContent();

 How to handle frame in selenium webdriver using java

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

  1.  How to print all the dropdown values
  2. How to Select the dropdown value inside a frame
  3. verify selected value from dropdown
  4. How to Verify dropdown values

Again switch back to main window from frame

Clicking On Logout Button

Close the Firefox Browser

Selenium Code :

package com.tests;

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;

importorg.openqa.selenium.support.ui.Select;

public class OrangeHRM_login {

public static void main(String[] args) throws Interrupted Exception {

// open the firefox browser

WebDriver driver = newFirefoxDriver();

// navigate the AppUrl

diver.get(“http://127.0.0.1/orangehrm-2.5.0.2/login.php”);

//Get the Title of WebPage

String title=driver.getTitle();

//print the title of the webpage

System.out.println(title);

//Verify Title of the WebPage

if (title.equals(“OrangeHRM – New Level of HR Management”)) {

System.out.println(“title is verified successfully”);

} else {

System.out.println(“title is not verified successfully”);

}

// Enter the username

  driver.findElement(By.name(“txtUserName”)).sendKeys(“selenium”);

// Enter the password

driver.findElement(By.name(“txtPassword”)).sendKeys(“selenium”);

// Clicking On Login Button

driver.findElement(By.name(“Submit”)).click();

// Identify and get  the Welcome selenium text and store into text variable

String text = driver.findElement(By.xpath(“//*[@id=’option-menu’]/li[1]”)).getText();

// Print the welcome selenium text

System.out.println(text);

//  To verify whether the welcome page successfully opened or not

if (text.equals(“Welcome selenium”)) {

System.out.println(“Welcome selenium is verified successfully”);

} else {

System.out.println(“Welcome selenium is not verified successfully”);

}

// Switch to Frame by ID

driver.switchTo().frame(“rightMenu”);

System.out.println(“****How to print all the dropdown values inside a frame****”);

Identify the dropdown

// Identify the dropdown

WebElement dropdown = driver.findElement(By.id(“loc_code”));

// Identify  dropdown values  and store into droplist  variable

List<WebElement> droplist = dropdown.findElements(By.tagName(“option”));

// How to print all the dropdown values

for (inti = 0; i<droplist.size(); i++) {

System.out.println(droplist.get(i).getText());

}

System.out.println(“*****How to Select the dropdown value inside a frame*****”);

Select the dropdown value inside a frame

/*

                    If u want to select the dropdown value then we need to create the select object for that dropdown

                    */

Select s = new Select(dropdown);

// Select the dropdown value by using index

s.selectByIndex(2);

//s.selectByVisibleText(“Emp. First Name”);

//s.selectByValue(“1”);

System.out.println(“****verify selected value from dropdown inside a frame *****”);

verify selected value from dropdown inside a frame

//get the selected value and store into selected_value variable

String  selected_value=s.getFirstSelectedOption().getText();

//print selected value

System.out.println(“selected_value  :”+selected_value);

//verify selected value from dropdown

if (selected_value.equals(“Emp. First Name”)) {

System.out.println(“selected value  verified successfully”);

} else {

System.out.println(“selected value not verified successfully”);

}

// How switch back to main window from inside any frame

driver.switchTo().defaultContent();

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’option-menu’]/li[3]/a”)).click();

// Close the Firefox Browser

driver.close();

}

}

Click here: How to verify multiple checkboxes in a webpage using selenium?

Click here: Steps to configure Selenium WebDriver with java to develop test scripts

Selenium Training in Hyderabad

Kosmik Technologies is on of the best selenium training institutes in Hyderabad. We are providing lab facilities with complete real-time training. Training is based on complete advance concepts. So that you can get easily “hands-on experience”. We will give 100% job assistance.

Kotlin For Android Developers

Kotlin For Android Developers

Kotlin For Android Developers

Kotlin is a new programming language from JetBrains, the maker of the world’s best IDEs. Now Kotlin supported by Google For Android.
 
Kotlin comes from industry, not academia. It solves problems faced by working programmers today. As an example, the type system helps you avoid null pointer exceptions. Research languages tend to not have null at all.

1. Why Kotlin

 
1.1 Java Interoperability
 
Kotlin language is inter-operable with java. It means we can user previous java project with new kotlin classes also and all java frameworks are still available. We have a one click java to kotlin converters also.
 
1.2 Familiar syntax
 
Kotlin Language syntax is very familiar to any programing language who came from OOP domine. There are some differences compare to Java such as val, var
 
Class Example{
 
val a:String= “Kosmik” //val means unmodifiable
 
Var i:int=1 // var means modifiable
 
}
 
Fun hellworld(){
 
Val str=”hello”
 
print(“$str World”)
 
}
 
1.3 String Interpolation
 
It’s as if a smarter and more readable version of Java’s String.format() built into the Kotlin language
 
var x=4
 
var y=3
 
print(“sum of $x and $y is ${x+y}”) //sum of 4 and 7 is 11
 
1.4 Open Source
 
It is open source under apache 2.0
 
1.5 Compatibility
 
Kotlin is fully compatible with JDK6 and kotlin applications can run on older android devices also
 
1.6 Performance
 
Kotlin application will run fast as an equal to java
 
1.7 Support
 
Kotlin is fully supported from Android Studio 3.0
 
1.8 Some Syntaxes
  1. No more semicolons ;
  2. Variable declaration is different in kotlin like var is mutable and val is immutable
  3. Functions in kotlin (methods)

fun sum (x: Int ,y: Int): Int{

return x+y

}

  1. when function

Now switch changed into when a condition, which is very easy to understand  like below example

when (x) {

   1 -> print(“x is 1”)

   2 -> print(“x is 2”)

   3, 4 -> print(“x is 3 or 4”)

   in 5..10 -> print(“x is 5, 6, 7, 8, 9, or 10”)

   else -> print(“x is out of range”)

}

6.creating a class in kotlin

val rectangle = Rectangle(5.0, 2.0) //no ‘new’ keyword required

val triangle = Triangle(3.0, 4.0, 5.0)

Android Training in Hyderabad

kosmik provides Android training in Hyderabad, we are providing lab facilities with complete real time training & 100% job assistance will be there