Top 10 Selenium Interview Questions.

Author: neptune | 02nd-Apr-2023
#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 | 08th-Aug-2023
#Selenium
We are going to automate a ticket booking using Selenium WebDriver and Cucumber BDD...

Where you applied OOPs in Automation Testing?
Author: neptune | 28th-Aug-2023
#Interview #Java
You may face this question Where you have applied OOPs concept in Automation Framework? in almost all the Selenium Interviews. Let's learn OOP’s concept in Java before going further...

Selenium, Cucumber, JUnit, TestNG dependencies for Selenium project.
Author: neptune | 02nd-Apr-2023
#Selenium #Testing
We guide you how to update the pom.xml file for Selenium Maven project...

5 Selenium Project Ideas & for Beginners in Automation Testing
Author: neptune | 30th-Mar-2023
#Selenium #Testing #Projects
In this article, we will discuss 5 interesting Selenium project ideas for beginners in automation testing...

How to use wait commands in Selenium WebDriver in Java ?
Author: neptune | 22nd-Feb-2022
#Selenium #Testing #Java
We are going to explore different types of waits in Selenium WebDriver. Implicit wait, Explicit wait, and Fluent wait with examples...

Top 50+ Selenium Interviews Questions 2023 based on Years of Experience
Author: neptune | 02nd-Apr-2023
#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...

Core Python Syllabus for Interviews
Author: neptune | 26th-Jul-2023
#Python #Interview
STRING MANIPULATION : Introduction to Python String, Accessing Individual Elements, String Operators, String Slices, String Functions and Methods...

Mostly asked Python Interview Questions - 2023.
Author: neptune | 30th-May-2023
#Python #Interview
Python interview questions for freshers. These questions asked in 2022 Python interviews...

Top 10 Selenium Interview Questions with answers (2021).
Author: neptune | 02nd-Apr-2023
#Selenium #Interview
In this article I will cover top 10 Selenium interview questions...

How to create Selenium Cucumber Project in Eclipse.
Author: neptune | 25th-May-2022
#Selenium
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...

30+ SQL Interview Questions
Author: neptune | 05th-Jan-2023
#Interview #SQL
Data Definition Language (DDL) – It allows end-users to CREATE, ALTER, and DELETE database objects...

Challenges faced in automating Web Applications using Selenium
Author: neptune | 02nd-Oct-2022
#Selenium #Testing
List of Challenges faced by testers using Selenium 1. Popup and Alert Handling, 2. Dynamic element Handling 3. Restricted to only Desktop Browsers Testing...

How to create a Selenium, Cucumber Automation project in Eclipse ?
Author: neptune | 02nd-Apr-2023
#Selenium #Testing
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...

20 TestNG Interview Questions
Author: neptune | 17th-Dec-2022
#Selenium #Interview
There is always more than one test or method in the class. If we do not prioritize these tests or methods, then the methods are selected alphabetically and executed while execution...

Getting started with Selenium WebDriver.
Author: neptune | 02nd-Apr-2023
#Selenium #Testing
In this blog I will give you an overview of Selenium WebDriver and Also discuss about advantages and disadvantages of Selenium WebDriver...

Why we use Robot Class in Automation Testing?
Author: neptune | 23rd-Aug-2022
#Selenium
Robot class is used to generate native system input events for the purpose of automation testing. It is used to perform mouse and keyboard events on windows applications or popups...

How to send POST request using Rest Assured framework in Java ?
Author: neptune | 26th-Mar-2023
#Selenium #API
Rest Assured is a popular Java-based framework that is used for testing RESTful web services. It provides a simple and intuitive API for sending HTTP requests and validating the responses...

Black Mirror Season 6: A Glimpse into the Future of Technology and Society
Author: neptune | 27th-Apr-2023
#Interview
Black Mirror Season 6, starring Salma Hayek and Aaron Paul, promises more violence and thought-provoking explorations of technology and society...

The Key to QA Success: Understanding How Important Grooming Is?
Author: neptune | 19th-Sep-2023
#Testing #Interview
We will delve into the importance of grooming & ceremony for QA testers, key points to highlight their significance...

Top 20+ Appium Interview Questions and Answers (2023)
Author: neptune | 30th-May-2023
#Interview
This article provides a comprehensive list of 20 common interview questions on Appium mobile automation, covering various topics and providing solutions for each question...

Skills Required for Full-Stack Developer at IBM Onsite, CA
Author: neptune | 25th-Feb-2024
#Interview #Jobs
The company's commitment to pushing the boundaries of what is possible necessitates a team of skilled professionals...

View More