MANUAL TESTING

 

  1. In How Many Ways Software Companies do Business?
  2. How Service Based Companies do Business?
  3. How Product Based Companies do Business?
  4. Is There any Much Difference  for a Tester to Work in  Service  Based  and Product Based  Companies
  5. How a Product will Become Successful in the Market
  6. Define Project and Product in Your own Words
  7. As a Tester what you will do in Service Based and Product Based                                      Companies
  8. Tell me Some Examples   for  Project and Product
  9. Define Quality in your own words
  10. How any Company can grow successfully?
  11. Why we need to deliver a quality product?
  12. What is the ultimate  goal of any company and how to achieve it
  13. What is testing?
  14. Why we need to do testing?
  15. If testing is not done what will happen?
  16. How can you say any software application is a quality application?
  17. What is a defect?
  18. Who will find defects and who will rectify defects?
  19. Explain what will happen after rectification of defect?
  20. Why any company is there in this world?
  21. Why customers need software?
  22. In how many ways customer approach   software companies?
  23. How customers generally finalize and select Software Company?
  24. Explain the bidding process in your own words
  25. How software companies get projects ?
  26. What is the importance of software now a days explain with some examples
  27. How much % of business now a days depending on software’s ?
  28. If existing softwares does not work what will happen?
  29. What is the first activity in the software company after getting a new project?
  30. What is the purpose of kick off meeting   ?
    1. Who will involve in KOM
    2. What is the need of domain Experts involvement in KOM?
    3. What is domain?
    4. What is the need of Customer Representative in KOM?
  31. Why they call this meeting as KOM? Is this the only meeting called as         KOM?
    1. On what basis project manager will be selected?
    2. Once project manager is selected what he will do?
    3. What is PIN? & what is the purpose of it?
    4. Who will prepare PIN? &for whome it will be sent?

 

  1. Explain what business analyst will do in initial phase?
  2. What is the use of template in Software Company?
  3. Explain advantage of prototype?
  4. If at all, customer gives any extra requirement’s then who will handle that & how he will handle it?
  5. Who is the author of requirement document?
  6. What is the name of outcome document of initial phase in your company?
  7. Which document will be the outcome of initial phase?
  8. Basically the outcome document of initial phase is prepared based on?
  9. What is the input document of analysis phase?
  10. What are the things which are generally analyze during analysis phase?
  11. If at all, feasibility study is not done? What will happen?
  12. What is the use of tentative planning? When it many be changed in future?
  13. Who will decide the technology information to develop the project?
  14. If customer suggests the technology our company will directly accept it or not?
  15. Why the environment should be confirmed or finalized in the initial stages only?
  16. What do you mean by requirement analysis?
  17. What is the outcome document of analysis phase?
  18. Who is the author of SRS?
  19. What is the input document for design phase?
  20. What is high-level design?
  21. What is low-level design?
  22. Why high-level & low-level design need to be done?
  23. What is the language used by the chief architect during design?
  24. What does T.D.D contains?
  25. What is Pseudo code? What is the use of it?
  26. What is GUI? What is use of it?
  27. What is the Software application?
  28. What is the responsibility of technical lead in the design phase?
  29. What is the input document of coding phase?
  30. How the developer will develop the actual code?
  31. What do you mean by coding standards & how they are useful?
  32. What is the outcome document of coding phase?
  33. What the developers will understand from T.D.D & how it is useful for developers while developing the actual code?
  34. Is the source code document, input for testing phase?
  35. What are 2 inputs testing department receives?
  36. While understanding the requirements if at all testers get any doubts, in how many ways they will clarity them? Explain?
  37. After understanding the requirements what testers will do?
  38. What do you mean by test case?
  39. After writing the test cases, what we will receive from the development department?
  40. Once first build is received, what testers will do?
  41. What is the document used for sending the defects to the development department?
  42. What is a defect?
  43. Once next build is released, what testers will do?
  44. If at all some defects are not rectified what testers will do?
  45. What is the outcome of testing phase?
  46. What is the need of testing?
  47. What are the things the tester will check during testing?
  48. If test engineer need to test something, first he need to understand what?
  49. Generally testing process starts with———————
  50. Who will deliver the application & how they will do it?
  51. How many types of maintenance are there?
  52. Whom we call as onsite employees?
  53. Can customers can also go for own maintenance?
  54. Who will do unconventional testing?
  55. Who will do conventional testing?
  56. What is the main goal of conventional testing?
  57. What is the main goal of unconventional testing?
  58. In a software company, how many department will take are of quality? &          what are they?
  59. How many methods (or) techniques are there in testing?
  60. Who will do gray box testing?
  61. Why so many companies do not encourage gray boxing testing?
  62. Why companies separately maintaining? Black box testers & white box testers?
  63. In how many stages testing need to be conducted & what are those stages ?
  64. Who will do unit level testing?
  65. In module level why black box test engineers will not concentrate on              structural part?
  66. To integrate the modules what developers will develop & who will test  them?
  67. Generally what approaches are followed to integrate modules?
  68. Why big bang approach is avoid by many companies?
  69. Is there any particular situation   where we need to go for hybrid   application?
  70. What is stub & driver?
  71. Whenever any mandatory module    is missing will you wait till the     module is developed if no then   explain how will you proceed?
  72. What is a system?
  73. Who will do what in system level    testing?
  74. What is need of system integration testing?
  75. Is Only system integration testing    conducted in system level testing?
  76. Who will do user acceptance level    testing?
  77. What is purpose of user acceptance    level testing whenever black box     test engineers feel that system is    working fine in system level itself?
  78. In which situations we suggest stand alone environment?
  79. On what basis we can suggest an environment to the customer?
  80. What are advantages of client server environment?
  81. What are drawbacks of client server environment?
  82. When ever web environment is looking better then client server then in which   situations we go for client server    environment?
  83. When ever we are using client server environment then what is need of web environment?
  84. When ever distributed environment is similar to web environment then what is need of distributed environment?
  85. What is thin client?
  86. What is thick client?
  87. Why both business logic & database     logic are not maintained in single servers?
  88. In web environment where we find     the business logic? What is advantage of having there?
  89. Why test engineer need to have test     environment knowledge?

 

  1. What do you mean by model?
  2. Will all the companies follow the same model?
  3. All the company will follow same model for all the projects? If no? Explain?
  4. Explain difference between V-model & waterfall model?
  5. In which situation generally they will go for prototype model?
  6. How many types of proto types are developed what are they?
  7. Tell me 1 major drawback of prototype model?
  8. Explain verification, validation in your own words?
  9. During validation also, verification will be conducted? Say yes or No
  10. Validation mainly focus on———–
  11. Verification mainly focus on ———
  12. What do you mean by port? Port testing?
  13. What is build acceptance testing & generally what we check in that?
  14. Without doing build acceptance testing, if we accept the build, what problems we many face?
  15. Will we do build acceptance testing after every build is released, while doing is released?
  16. What is build acceptance testing & generally want we check in that?
  17. Once first build is released, while doing detailed testing, retesting is required? if yes? Why?
  18. Once first build is released? Will we do regression testing?
  19. Regression testing starts from ————–& continues to —————-
  20. Retesting required to be done, during regression testing? If yes? Why?
  21. What do you mean by re& regression testing?
  22. Retesting starts from ———& continues till —————
  23. Is it required, to perform regression testing always during testing? If no? Explain?
  24. Is it true that retesting is required always during regression testing?
  25. With what type of testing, we start testing process?
  26. Tell me difference between alpha & beta testing?
  27. Whenever alpha testing is conducted, what is the need of beta testing?
  28. Is beta testing always needed to be conducted? If no? Explain?
  29. What is the importance of alpha and beta testing?
  30. Generally which customer prefers to go for beta testing?
  31. Is alpha testing conducted on customer interest or companies’ interest?
  32. What are the benefits of beta testing?
  33. What we will achieve after alpha testing?
  34. In which place, Beta testing is done?
  35. In which place, alpha testing is conducted?
  36. Beta testing is conducted by whom?
  37. If beta testing is not conducted, what problems company may face?
  38. Define static & dynamic testing?
  39. Document testing falls under———
  40. GUI testing falls under——testing
  41. Code reviews falls under—— testing
  42. Functionality falls under——testing
  43. Performance falls under——-testing
  44. Usability falls under———-testing
  45. What is the main purpose of installation testing?
  46. After every new build is released Will we do installation testing? No?
  47. Compatibility testing is compulsory conducted in———— based companies
  48. What is mutation testing?
  49. What do you mean by “mutant”?
  50. Give some examples for mutation testing?
  51. What is security testing?
  52. Who will do security testing?
  53. Which areas generally black box test engineers will concentrate in security testing?
  54. Explain how will you do direct URL testing?
  55. Explain difference between direct URL testing& user privileges testing?
  56. Who will do authentication testing? How it will be done?
  57. Can every authorized user of the application can access all the areas of the application? If no –explain?
  58. What is end to end testing? Is it compulsory for every project?
  59. While doing end to end testing how black box testing engineer should think & get ideas?
  60. What do you mean by end to end?
  61. What is the difference between compatibility testing & port testing?
  62. What are the advantages of port testing?
  63. Is compatibility testing required for projects also? Explain?
  64. If we don’t do usability testing? What will be the main problem?
  65. Give me some areas where we generally check the friendliness?
  66. How can we say any product is a quality product?
  67. Tell me some type of testing which are not required for all the projects?
  68. Tell me some important types of testing which need to be conducted on any project?
  69. Tell me 2 types of stress testing?
  70. What is difference between monkey testing & reliability testing?
  71. What do you focus during monkey testing?
  72. What do you focus during reliability testing?
  73. How u will do monkey testing?
  74. How you will do reliability testing manually?
  75. Can we do reliability testing manually?
  76. Can we do exploratory testing manually?
  77. What is the need of exploratory testing?
  78. In which situations we prefer exploratory testing?
  79. Is it compulsory to do exploratory testing on all the projects?
  80. Can a fresher do exploratory testing?
  81. What is the difference between exploratory & adhoc testing?
  82. Who will do adhoc testing?
  83. When the adhoc testing need to be done?
  84. What is the main goal of adhoc testing?
  85. What do you mean by exploring?
  86. In all the companies the Adhoc testing need to be encouraged on all the   Projects?  Explain?
  87. What is the use of “objective” in the test plan document?
  88. Generally which documents test lead will refer while preparing test plan document?
  89. With whom the test lead will involve in the meeting before starting the test plan?
  90. What will be there under features not be tested? Explain with some examples?
  91. What do you mean by out of scope feature?
  92. What do you mean by future functionality?
  93. Why low risk areas are not initially concentrated?
  94. What is the difference between test plan & test strategy?
  95. When we have test strategy, what is need of test plan?
  96. The contents in the test strategy will describe?
  97. What do you mean by test metric?
  98. Do all companies use same “terminology”?
  99. Name any two test design techniques?
  100. What is the use of test design techniques?
  101. When will you stop testing?
  102. When will you suspend testing?
  103. Can a test engineer take own decision & suspend the application?
  104. What do you mean by test deliverables? Why test engineer should have   knowledge of test environment?
  105. What is resource planning? & scheduling?
  106. Tell me some situations where training is required to accomplish the project successfully?
  107. Whenever a new project comes, will they rewrite a new staff? If yes? Explain?
  108. What do you mean by risk, contingencies with example?
  109. When ever a customer imposes the deadlines how will you handle the situation?
  110. Whenever the time given is not sufficient, what will you do?
  111. What do you mean by assumptions
  112. Should a test engineer, always need to assume during testing?
  113. Who will approve test plan document?
  114. Who will prepare test plan document?
  115. What is purpose of test plan document?
  116. Does test engineer prepare test plan document?
  117. Whenever the time given is not sufficient, what will you do?
  118. What will be there in requirement documents?
  119. What a test engineer should mainly focus in the requirements document?
  120. What is the use of screen shots in the requirements document?
  121. What do you mean by use case & what is the use of it?
  122. What is the difference between high level information & low level information?
  123. What is the difference between implicit requirements & explicit requirements?
  124. What will define implicit requirements & what is use of it?
  125. What is pre condition & post condition?
  126. Basically any application has how many flows?
  127. Soon after a test engineer receives use case document what he will do? Explain briefly?
  128. What is the functional point?
  129. What is the difference between test scenario & a test case?

 

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.

 

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.

Steps to configure Selenium WebDriver with java to develop test scripts

Pre-conditions: We need below files

Step 1: Download and Install JDK 8

Follow below URL

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

Select Accept License Agreement radio button

Java SE Development Kit 8

Choose version to download: Windows 86 or x64 based on your OS (jdk-8-windows-i586.exe and jdk-8-windows-x64.exe)

  • wait until complete download.
  • copy downloaded file and paste in personal folder.
  • click on setup to start installation.
  • click on next until installation will go to end
  • click on close.
  • Restart Computer.

Note :

After completion of JDK installation tester can create environment variable for JAVA_HOME in your windows system by following below navigation.

  • Click on start
  • Right click on my computer
  • Click on properties
  • Click on Advanced system setting
  • Select Advanced tab
  • Click on Environment variable button
  • Go to user variables
  • click on New button
  • Type JAVA_HOME and provide path of JDK folder
  • click on ok

Follow below image

Environment variable button

  • Go to system variable
  • Select path
  • click on Edit button
  • Add path of JDK bin folder followed by semicolon(😉 at the end of existing path value
  • Click on ok
  • Click on ok

Follow below image

Environment variables

How to verify java successfully installed or not into your local system

  • Open the command prompt.
  • Run command “java -version”

 

It should show your installed java version detail as shown in above image. That means java is installed successfully into your local system and you are ready to use it.

Step 2: Download and launch Eclipse IDE

  1. IDE stands for Intigrated Development Environment. Eclipse Ide is useful to write our test scripts in java or java based tools like selenium.
  1. We need to follow below URL to download and launch Eclipse Ide

 

http://www.eclipse.org/downloads/packages/release/Mars/2

Eclipse Mars 2 Packages

 

Download the Eclipse Mars, you can choose version Windows 32 bit or 64 bit based on your OS

  • wait until complete download.
  • copy downloaded file and paste into personal folder and extract
  • click on Eclipse folder
  • Here click on ‘eclipse.exe’ file directly. Here no need to install eclipse into your local system.

Step 3: Download Selenium WebDriver Jar Files.

After completion of eclipse Ide launching with the creation of project, package, and class with main(), we need to download selenium webdriver jar file.

Follow the below steps :

  • Go to google search
  • Enter seleniumhq then search it
  • Click on first link(https://www.seleniumhq.org/download/)
  • Click on download
  • Scroll to Selenium Client & WebDriver Language Bindings
  • Click on download for java based selenium webdriver

Selenium Client & WebDriver Language Bindings

  • wait until complete download.
  • copy downloaded jar file and paste into personal folder and extract

Step 4: Associate selenium webdriver with eclipse Ide.

  • click on ‘eclipse.exe’ to start eclipse
  • First time when you start eclipse software application, it will ask you to select your workspace where your work will be stored as shown in bellow image.

Workspace Launcher

Choose a workspace folder name as D:\workspace and click on ok button .Here You can change the workspace location from ‘Switch Workspace’ under ‘file’ menu of eclipse.

Create new project

  • Go to File
  • New
  • Go to Java Project and give your project name ‘SeleniumProject’
  • Click on finish button.

Create new package

  • Right click on source folder(src)
  • New
  • Package
  • give the package name ‘SeleniumTests’
  • Click on finish button.

Create New Class

  • Right click on package ‘SeleniumTests’
  • New Class
  • give the class name ‘myTestLogin’
  • click on Finish button.

Add external jars for that project

  • Right click on project ‘SeleniumProject’
  • go to Java build path
  • configure build path
  • >select Libraries
  • Click on add external JARs button
  • Then go your jar file folder path location
  • select both .jar files from D:\selenium-java 3.12.0.
  • click on open button
  • Click on add external JARs button
  • Then go your jar file folder path location
  • select all .jar files from D:\selenium-java 3.11.0\libs
  • click on open button
  • click on ok button

Steps to Download and Install firebug Add-on.

Follow my below url to install Fire Bug

https://addons.mozilla.org/en-US/firefox/addon/firebug/

Click on Add to Firefox button

Click on Install button

After install FireBug then go to

Tools > Web Developer > Firebug > Open Firebug (or)you can use shortcut key ‘F12’

 

After open the firebug. Right-click on field or element in your application then click on inspect element with firebug option.

In html code take either id(or)name(or)className etc. from highlighted section.

See below image

Hospital Management System

Note: Here no need to restart your Firefox after installing Firebug Add-On

Steps to Download and Install firepath Add-on.

Follow my below url to install Firepath add-on

https://addons.mozilla.org/en-US/firefox/addon/firepath/

Click on Add to Firefox button

FirePath By pierre Tholence

Click on Install button

Click on Restart Now

After install firepath then go to

Tools > Web Developer > Firebug > Open Firebug (or)you can use shortcut key ‘F12’

You could find ‘FirePath’ as shown below image

 

Selenium WebDriver First Program :

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 Dashboard Text
  • Print the Dashboard Text
  • To verify whether the welcome page successfully opened or not
  • Clicking On Logout Button
  • Close the current Firefox Browser

Selenium Code :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class SampleClass {

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

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

//Get the Title of the WebPage

String title=driver.getTitle();

//print the title of the webpage

System.out.println(title);

//Verify Title of the WebPage

if (title.equals(“Administration”))

{

System.out.println(“title verifiedsuccessfully”);

} else {

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

}

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

// Enter the password

driver.findElement(By.name(“password”)).sendKeys (“K@admin”);

// Clicking On Login Button

driver.findElement(By.xpath(“//*[@id=’content’]/ div/div/div/div/div[2]/form/div[3]/button”)).cli ck();

// Identify and get the Dashboard Text

String text = driver.findElement(By.xpath(“//*[@id=’content’]/div[1]/div/h1”)).getText();

// Print the Dashboard Text

System.out.println(text);

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

if (text.equals(“Dashboard”))

{

System.out.println(“Welcome pageverified successfully”);

} else {

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

}

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’header’]/u l/li[3]/a”)).click();

//Close the current Firefox Browser driver.close();

}

}

SELENIUM | BROWSER COMMANDS :

1.get() : This will be used to navigate the application url

Syntax : driver.get(“appURL”);

2.getTitle() : This will be used to get the title of the current Webpage.

Syntax : driver.getTitle();

3.findElement() : By using this we can identify single webelement On a webpage.

Ex: Button, checkbox, radio button etc.

Syntax : driver.findElement(By.Locator(“Locator-Value”));

4.findElements() : By using this we can identify list of webelements On a webpage.

Ex :

  1. Suppose if you want to identify dropdown values at a time then we use findElements method.
  2. Suppose if you want to identify list of frames in a webpage then we use findElements method.
  3. Suppose if you want to identify list of links in a webpage then we use findElements method.

Syntax :

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

5.sendKeys() : If you want to give the value to the input field(textbox,text area) then we use sendkeys method.

Syntax :

driver.findElement(By.locator(“locator-value”)).sendKeys(“text”);

6.getText() : If you want to get the particular text in a webpage then we use getText method.

Syntax :

String PageText=driver.findElement(By.Locator(“Locator-value”)).getText();

7.click() :Is there any click operation in your application then we use click().

Syntax :

driver.findElement(By.Locator(“Locator-value”)).click();

8.close() : This will be used to close the current browser window.

Syntax : driver.close();

Important Interview Questions :

1. How to Identify WebElement in selenium webdriver?

A )By using firebug and firepath we can Identify

WebElement.

2. Can we use firebug and firepath for chrome and Ie?

No,

1.Here firebug and firepath these two add-ons only for firefox.

2.Suppose if u want to identify the WebElement In chrome and ie here no need to install firebug and firepath. Becoz chrome and ie have its won developer tool to identify the web element.

3. What is the default package of selenium?

  1. org.openqa.selenium

4. What is the difference between findElement() and findElements()?Find ElementsfindElement() :

By using this we can identify single webelement On a webpage.

Ex : Button, checkbox,radio button etc.

Syntax : driver.findElement(By.Locator(“Locator-Value”));

TestSteps :

  • open the firefox browser
  • navigate the application url Enter the username
  • Close the current Firefox Browser

Selenium Program :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class findElementMethod {

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

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

//Close the current Firefox Browser

driver.close()

}

}

findElements() : By using this we can identify list of webelements On a webpage.

Ex :

  • Suppose if you want to identify dropdown values at a time then we use findElements method.
  • Suppose if you want to identify list of frames in a webpage then we use findElements method.
  • Suppose if you want to identify list of links in a webpage then we use findElements method.

Syntax :

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

TestSteps :

  • open the firefox browser
  • navigate the application url
  • Identify all the links and store into total_Links variable Print the total Links on a webpage
  • Close the current Firefox Browser

Selenium Program :

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

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

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

//Identify all the links and store into total_Links variable

List<WebElement> total_Links = driver.findElements(By.tagName(“a”));

//Print the total Links on a webpage

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

//Close the current Firefox Browser

driver.close();

}

}

5.How to verify particular text on a webpage using selenium webdriver?  (Or) How to verify successful message on a webpage using selenium webdriver?

TestSteps :

  • open the firefox browser
  • navigate the application url Enter the username
  • Enter the password
  • Clicking On Login Button
  • Identify and get the Dashboard Text Print the Dashboard Text
  • To verify whether the welcome page successfully opened or not Clicking On Logout Button
  • Close the current Firefox Browser

Selenium Program :

package seleniumProject;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.firefox.FirefoxDriver;

public class SampleClass {

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

// open the firefox browser

WebDriver driver = new FirefoxDriver();

// navigate the application url

driver.get(“http://www.kosmiktechnologies.com/se leniumLiveProject/eKart/admin/”);

// Enter the username

driver.findElement(By.name(“username”)).sendKeys (“Kadmin”);

// Enter the password

driver.findElement(By.name(“password”)).sendKeys (“K@admin”);

// Clicking On Login Button

driver.findElement(By.xpath(“//*[@id=’content’]/

div/div/div/div/div[2]/form/div[3]/button”)).click();

// Identify and get the Dashboard Text

String text =

driver.findElement(By.xpath(“//*[@id=’content’]/ div[1]/div/h1”)).getText();

// Print the Dashboard Text

System.out.println(text);

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

if (text.equals(“Dashboard”))

{

System.out.println(“Text matched”);

} else {

System.out.println(“Text notmatched”);

}

// Clicking On Logout Button

driver.findElement(By.xpath(“//*[@id=’header’]/u l/li[3]/a”)).click();

//Close the current Firefox Browser

driver.close();

}

}

Control statements :

Syntax :

If(Actual_value.equals(Expected_value))

{

//Execute the code if condition is true

}else

{

//Execute the code if condition is false

}

Actual_value : Take the text from Testing Application.

Expected_value : client requirement

6.Difference between close() and quit() in selenium webdriver ?
Driver.close() :

By using this we can close the current browser window.

I.e Single window on which driver is having focus that will be closed only

Difference between close() and quit() in selenium webdriver

Driver.quit() : Every associated browser will be closed

I.e closed all the windows opened by the driver.

7. What is the purpose of public static void main() in java ?

public :

Since main() should be available to JVM. It should be declared as public.I f we don’t use main() as a public then it doesn’t make itself available to JVM and JVM cannot execute it.

Static :

We should be call the main() without creating an object, such methods are called static methods and we should be declared as static.

Void :

If main() it does not written any value then you have to put void(no value) before the main().

main():

If main() is not written in the java program then JVM will not execute the program.main() is the starting point for JVM to start execution of java.

What are the pre-requisites to run the selenium web driver?
  1. JDK 8
  1. Eclipse IDE
  1. Selenium JAR file
  1. Testing Application
  1. Browser (Firefox 53.0)
  1. Firebug
  1. Firepath

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

How to verify multiple checkboxes in a webpage using selenium?

Selenium Training in Hyderabad

kosmik technologies is the best institute for selenium training in Hyderabad. we offer classroom and selenium online training courses by certified faculty. Selenium is an open source tool for web application testing. This tool primarily developed in JavaScript and browser technologies and hence supports all major browsers on all the platforms. Selenium is one of the best tool available in the market for a web application.