Table of contents
No headings in the article.
The testing plays a very important role in SDLC(Software Development Life Cycle). The role of a tester is very crucial and can't be determined. This article covers top 10 important questions asked during the interview.
Que-1 What are the different ways locating an element in selenium?
Ans There are multiple ways of locating an element in selenium and they are as:
- Css Selector
- Id
- XPath
- tagName
- className
- Name
- link text
- partialLinkText
Que-2 How can we move to the parent of children element using XPath?
Ans In order to move to the parent element we can use '/' after the expression of child element. For example- the locator //div[[@ id]=”childId”]/.. will move to the parent of the div element with id value as ‘childId’.
Que-3 What is the command with which we can store a value in text box?
Ans A command which can store the value from the text box using a web driver.
For example,
driver.findElement(By.id(“your Textbox”)).sendKeys(“your keyword”);
Que-4 What is node in Selenium grid?
Ans Node is a remote device that is attached to the selenium grid hub. It receives requests from the hub and executes them with the help of selenium webdriver. Unlike hub there can be multiple nodes in a selenium grid.
Que-5 Explain the line of code Webdriver = new FirefoxDriver();.
Ans Webdriver is an interface and the methods that are declared in the Webdriver are implemented by respective Webdriver class.
WebDriver driver = new FirefoxDriver();
Here, WebDriver is an interface, driver is a reference variable, FirefoxDriver() is a Constructor, new is a keyword, and new FirefoxDriver() is an Object.
Que-6 How can we check if an element is enabled for interaction on a web page?
Ans Using the isEnabled method, we can check if an element is enabled or not.
driver.findElement(By locator).isEnabled();
Que-7 What is a hybrid framework?
Ans A hybrid framework is a combination of two or more frameworks. For example, a combination of data-driven and keyword-driven frameworks can be considered as a hybrid framework.
Que-8 What is a data-driven framework?
Ans A data-driven framework is one in which the test data is put in external files like CSV, Excel, etc. Basically, the test data is separated from the test logic that is written in test script files. The test data drives the test cases, i.e. the test methods run for each set of test data values.
Que-9 What do you understand by Page Object Model or POM?
Ans Page Object Model(POM) is a design pattern in Selenium. A design pattern is a solution or a set of standards that are used for solving commonly occurring software problems.
Now coming to POM – POM helps to create a framework for maintaining selenium scripts. In POM for each page of the application, a class is created having the web elements belonging to the page and methods handling the events on that page. The test scripts are maintained in separate files and the methods of the page object files are called from the test scripts file.
In this way, we can create a robust automation framework using POM.
Que-10 Which API is used to read and write data to excel files?
Ans Apache POI is an open source java library and JXL(Java Excel API) that can be used for reading, writing, and updating excel files.
So, this is the end of the article. I have covered some of the important questions that are asked during the selenium interview questions. Do prepare these, so that you can excel yourself before any interview. Thanks for reading.:)
Author - Rahul Singh(Linkedin Profile ) I am an engineering graduate from MITS Gwalior. I am a tech enthusiast and an avid learner. I like to read and write about technology-related topics.