Share

Top 10 Selenium Interview Questions.

Author: neptune | 03rd-Jun-2022 | views: 75
#Selenium #Interview

1.What are Locators? Describe various types of locators?

Locator is a command that tells Selenium IDE which GUI elements (like Text Box, Buttons, Check Boxes etc) we are going to use or perform some automation task.

Different types of locators in Selenium are:-

By.id()

By.name()

By.tagName()

By.className()

By.linkText()

By.partialLinkText()

By.xpath

By.cssSelector()


2.How can you handle dropdowns in Selenium?

The Select class in Selenium WebDriver is used for selecting options in a dropdown.We can initialize dropdown  by passing the dropdown webElement as parameter to its constructor.

There are three ways to select the dropdown:-

  1. .selectByIndex()

  2. .selectByValue()

  3. .selectByVisibleText()

Example: 

WebElement drpdownele = driver.findElement(By.id("idvalue"));  

Select dropdown = new Select(drpdownele );  

dropdown.selectByIndex(5);

     Or 

dropdown.selectByVisibleText("Bangalore");

    Or 

dropdown.selectByValue(“Bangalore”);


3.Describe different kinds of waits in Selenium?

Types of Wait in selenium webdriver are:-

  1. Implicit Wait: It is used to tell the web driver to wait for a certain amount of time before it throws a "No Such Element Exception". 

Syntax:

driver.manage().timeouts() .implicitlyWait(1000);

  1. Explicit Wait : Explicit waits stop the execution until the time a particular condition is met or the maximum time has elapsed.

  2. Fluent wait: The Fluent Wait defines the maximum time for the web driver to wait for a condition. We can also set a frequency to check the condition before throwing an "ElementNotVisibleException" exception. It also checks for the web element at regular intervals until the object is not found.



4. How are Selenium Scripts executed?

Steps to be followed to execute Selenium Script using Selenium IDE and Eclipse:-

  1. Install Java JDK 

  2. Configure java path in System variables

  3. Install Eclipse and create Eclipse Project

  4. Download and Configure Selenium Jar files

  5. Choses browsers to run

  6. Create Object for Driver

  7. Set System property of Browser

Syntax: 

public static void main(String[] args) {

 System.setProperty ("webdriver.chrome.driver", "C:\\chromedriver_win32\\ chromedriver.exe");

   

 WebDriver driver = new ChromeDriver();

    

    String baseUrl = "http://demo.guru99.com/ test/newtours/";

}

5. What are advantages and Disadvantages of using Selenium automation tools?

Solution

Advantages of using Selenium are:

  1. Selenium is an Open Source Software.

  2. Selenium supports various programming languages(like Python, Java, Ruby, pHp etc)

  3.  Selenium supports various operating systems (like Windows, Linux, Macintosh etc).

  4. Selenium supports various Browsers (like Mozilla Firefox, Google Chrome, IE, Opera, Safari etc)

  5. Selenium supports Parallel Test Execution.

Disadvantages of using Selenium are:

  1.  It supports Web based applications only.

  2.  Difficult to use, takes more time to create Test cases.

  3.  Limited support for Image Testing.

  4. Difficult to Setup Test Environment when it compares to Vendor Tools like SilkTest etc


6.Describe the Components of selenium?

Selenium components are: 

  1. Selenium IDE: Selenium IDE (Integrated Development Environment) is primarily used to develop test cases. Selenium IDE is an easy to use tool from the Selenium Test Suite. We can automate tests for our  web applications easily.

  2. Selenium RC:  It is a testing framework that enables a QA or a developer to write test cases in any programming language in order to automate UI tests for web applications against any HTTP website. 

  3. Selenium WebDriver: It is a widely used component. It is used to overcome the disadvantages of Selenium RC. Selenium WebDriver does not have a server and it communicates with the browser and runs it. It supports multiple OS platforms and browsers.

  4. Selenium Grid: Selenium Grid is a smart proxy server that makes it easy to run tests in parallel on multiple machines. This is done by routing commands to remote web browser instances, where one server acts as the hub. This hub routes test commands that are in JSON format to multiple registered Grid nodes 


7. What is the difference between FindElement and FindElements in Selenium?

Selenium defines two methods for identifying web elements: 

  1. findElement: A command used to uniquely identify a web element within the web page. 

  2. findElements: A command used to identify a list of web elements within the web page.


8. What is the framework in selenium? Describe the various kinds of framework?

Selenium Framework is a code structure that helps to make code maintenance easy. Without frameworks, we will place the “code” as well as “data” in the same place which is neither reusable nor readable. 

Using Frameworks, produce beneficial outcomes like increased code re-usage, higher portability, reduced script maintenance cost, higher code readability, etc.

There are mainly three types of frameworks

  • Data-Driven Test Framework: We need a way to open the Excel sheet and read data from it within our test script. All of our test data is generated from some external files like Excel, CSV, XML or some database table.

  • Keyword Driven Test Framework: In the keyword-driven test framework, all the operations and instructions are Keyword Driven Framework is a type of Functional Automation Testing Framework which is also known as Table-Driven testing or Action Word based testing. The basic working of the Keyword Driven Framework is to divide the Test Case into four different parts. First is called Test Step, second is Object of Test Step, third is Action on Test Object and fourth is Data for Test Object.

  • Hybrid Test Framework: It is an easy to use framework which allows manual testers to create test cases by just looking at the keywords, test data and object repository without coding in the framework. Hybrid Driven Framework is a mix of both the Data-Driven and Keyword Driven frameworks. 


9.What are xpath and xpath axes methods? Describe the types of xpaths and various xpath axes methods?

Xpath : XPath can be used for both HTML and XML documents to find the location of any element on a webpage using HTML DOM structure.

Types Of XPath In Selenium?

There are two types of XPath

  1. Absolute XPath

  2. Relative XPath


XPath axes : It searches different nodes in XML documents from the current context node. XPath Axes are the methods used to find dynamic elements, which otherwise are not possible by normal XPath methods having no ID , Classname, Name etc.

Various xpath axes methods are:

  1. Ancestor : It specifies the ancestors of the current nodes which include the parents up to the root node.

  2. Child: It specifies the children of the current node.

  3. Parent : It specifies the parent of the current node.

  4. Descendant: It specifies the descendants of the current node i.e. the node's children up to the leaf node(no more children).

  5. Manymore

10. How can you validate text in web pages by using selenium?

There are more than one ways to find it. We can use the getPageSource() method to fetch the full page source and then verify if the text exists there. This method returns content in the form of a string.

We can also check if some text exists with the help of findElements method with xpath locator. Then we shall use the text() function to create a customized xpath. The findElements() method returns a list of elements.






anonymous | June 3, 2022, 9:58 a.m.

👍


anonymous | June 3, 2022, 8:12 a.m.

👍



Related Blogs
Automate Ticket Booking in SpiceJet from Delhi to Bengaluru using Selenium and Cucumber.
Author: neptune | 17th-May-2022 | views: 2843
#Selenium #Cucumber
We are going to automate a ticket booking using Selenium WebDriver and Cucumber BDD...
Selenium, Cucumber, JUnit, TestNG dependencies for Selenium project.
Author: neptune | 25th-May-2022 | views: 1030
#Selenium #Testing #Cucumber #Projects
We guide you how to update the pom.xml file for Selenium Maven project...
Mostly asked Python Interview Questions - 2022.
Author: neptune | 25th-May-2022 | views: 702
#Python #Interview
Python interview questions for freshers. These questions asked in 2022 Python interviews...
Top 10 Selenium Interview Questions with answers (2021).
Author: neptune | 23rd-Feb-2022 | views: 625
#Selenium
In this article I will cover top 10 Selenium interview questions...
Top 50+ Selenium Interviews Questions 2022 based on Years of Experience
Author: neptune | 31st-May-2022 | views: 547
#Selenium #Testing #Interview
Every interview difficulty is based on how many years of experience you have in that field. For the Selenium Automation Tester I have divided the question on the number of years of experience...
How to use wait commands in Selenium WebDriver in Java ?
Author: neptune | 22nd-Feb-2022 | views: 534
#Selenium #Testing #Java
We are going to explore different types of waits in Selenium WebDriver. Implicit wait, Explicit wait, and Fluent wait with examples...
Mostly asked Cucumber interview questions in selenium automation interviews.
Author: neptune | 28th-May-2022 | views: 459
#Selenium #Testing #Cucumber
We are going to explore widely asked Cucumber interview questions in selenium automation interviews...
25 Basic Java interview questions.
Author: neptune | 30th-May-2022 | views: 377
#Interview #Java
We will explore 25 basic Java interview questions...
Getting started with Selenium WebDriver.
Author: neptune | 15th-Apr-2022 | views: 202
#Selenium #Testing
In this blog I will give you an overview of Selenium WebDriver and Also discuss about advantages and disadvantages of Selenium WebDriver...
How to create Selenium Cucumber Project in Eclipse.
Author: neptune | 25th-May-2022 | views: 141
#Selenium #Cucumber
First, divide the process into the various steps to understand working in brief of a project. Steps in brief: We’ll start with initializing the browser driver and then log in to the web page...
Core Python Syllabus for Interviews
Author: neptune | 11th-Jun-2022 | views: 124
#Python #Interview
STRING MANIPULATION : Introduction to Python String, Accessing Individual Elements, String Operators, String Slices, String Functions and Methods...
How to create a Selenium, Cucumber Automation project in Eclipse ?
Author: neptune | 19th-Apr-2022 | views: 106
#Selenium #Testing #Cucumber
Problem Statement : Let’s consider this particular project where we will try automating the process of booking a flight ticket. Let’s get started and see how it’s done using Selenium...
Java Script Interview Questions
Author: neptune | 09th-May-2022 | views: 70
#JavaScript #Interview
Basic JavaScript questions asked in interviews : 1. What are the different data types present in javascript? 2. Difference between "==" and "===" operators...
View More