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.