Tuesday 5 July 2022

Top 90 Selenium Interview questions and answers for experienced SDET - QAE - Automation QA 2022?


Check Selenium Interview questions from 1 to 10 below:


Check Selenium-SDET-UIAutomation Questions set 11 to 20:
Qus Set - 11 to 20

Check Selenium-SDET-UIAutomation Questions set 21 to 30:
 
Check Selenium-SDET-UIAutomation Questions set 31 to 40:

 Question Set 31-40  

Let's revise our understanding on Selenium first.

Webdriver:

WebDriver drives a browser natively, as a user would, either locally or on a remote machine using the Selenium server, marks a leap forward in terms of browser automation.

Selenium WebDriver refers to both the language bindings and the implementations of the individual browser control code. This is commonly referred to as just WebDriver and its not a class but an INTERFACE.

Selenium WebDriver is a W3C Recommendation

  • WebDriver is designed as a simple and more concise programming interface.

  • WebDriver is a compact object-oriented API.

  • It drives the browser effectively.

  • The latest release is Selenium 4.

71. How to check Text is Bold or not using selenium ?

Ans: In Selenium using  getCssValue() method we can get the specific property and we can check text is Bold or not.

Lets assume text which we are trying to check Bold or not is "Automation"

        WebElement text = driver.findElement(By.xpath("//*[contains(text(),'Automation')]"));
       
       
        //Read font-weight property and print It In console.

          String fontSize = text.getCssValue("font-weight");
          System.out.println("Font color -> "+fontSize);





72. What is staleElementException, what are the causes and resolution for it?

Ans: 
A StaleElementException is thrown when the element you were Interaction is destroyed and then recreated. Most complex web pages these days will move things about on the fly as the user interacts with it and this requires elements in the DOM to be destroyed and recreated.

When this happens, the reference to the element in the DOM that you previously had becomes stale and you are no longer able to use this reference to interact with the elements in the DOM. When this happens, you will need to refresh your reference, or in real world terms find the element again.

The stale element reference exception is a WebDriver error that is thrown in the following two cases:

1. The referenced web element has been deleted completely. 
2. The element is no longer attached to the DOM

To resolve this, we can refresh the page using navigate() or with try-catch block.


73. How to retrieve css properties of an element in selenium?

Ans: driver.findElement(By.id(“id“)).getCssValue(“name of the css attribute”);

74.  What is the Selenium's Recording language?

Ans: Selenium recording language is HTML

75. How to refresh browser without using navigate()?

Ans: Using sendKeys(Keys.F5)


76. What are the new features in Selenium 4? VERY IMP 

Click Here For Answer

77.  What is the best way to resolve NoSuchElementException in Selenium?

Ans:

 You can never be sure that element will be found, this is purpose of functional tests - to tell you if anything changed on your page. But one thing which definitely helps is to add waits for the elements which are often causing NoSuchElementException like

WebDriverWait wait = new WebDriverWait(webDriver, timeoutInSeconds);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id<locator>));

78. What is page load strategy in Selenium?

Ans: Click Here For Answer In-Detail

79. What is the default time for implicit and explicit wait?

Implicit wait default time is zero.
Explicit wait default time is 500 ms

How to perform back,forward and refresh action in selenium?

  • driver.navigate().back()
  • driver.navigate().forward ()
  • driver.navigate().refresh()


What is the return type of findelements?

List of elements with similar property

What will happen if no webelement is found for findelements?


It will return an empty list

What will happen if no webelement is found for findelement?

It will give error as :NoSuchElementException

80. Explain some of the keywords that have been used in your project for BDD approach?

Ans: Click Here For Answer With Example

81. What is TDD and BDD?

Test Driven Development (TDD)

Rather than a test type per se, TDD is an iterative development methodology in which tests drive the design of a feature.

Each cycle starts by creating a set of unit tests that the feature should eventually pass (they should fail their first time executed).

After this, development takes place to make the tests pass. The tests are executed again, starting another cycle and this process continues until all tests are passing.

This aims to speed up the development of an application based on the fact that defects are less costly the earlier they are found.

Behavior-driven development (BDD)

BDD is also an iterative development methodology based on the above TDD, in which the goal is to involve all the parties in the development of an application.

Each cycle starts by creating some specifications (which should fail). Then create the failing unit tests (which should also fail) and then do the development.

This cycle is repeated until all types of tests are passed.

In order to do so, a specification language is used. It should be understandable by all parties and simple, standard and explicit. Most tools use Gherkin as this language.

The goal is to be able to detect even more errors than TDD, by targeting potential acceptance errors too and make communication between parties smoother.

A set of tools are currently available to write the specifications and match them with code functions, such as Cucumber or SpecFlow.

A set of tools are built on top of Selenium to make this process even faster by directly transforming the BDD specifications into executable code. Some of these are JBehave, Capybara and Robot Framework.

***what does selenium do or what is selenium: Though we all know but remember it is not a tool, Selenium is an open source umbrella project for a range of tools and libraries aimed at supporting browser automation.

Revision:

49. Which Source code management tool you have used and tell me some of the basic commands that you have used?

Click here for answer

50. Have you worked on database side for fetching data to validate in selenium tests, if Yes then can you tell me some of the basic queries that you have used in day to day work?

Click here for answer with 11 queries

36.  How to launch batch file from Selenium WebDriver?

 Process batch = Runtime.getRuntime.exec("path of the batch file");

37. How to run selenium test from command line?

java -classpath ".;selenium-server-standalone-2.33.0.jar" SampleClass

38. What is the name of the super interface of the Webdriver?

Ans: SearchContext.

39. Explain some of the strategy you have followed while using xpath?

Click here for answer

40. How to execute the testng test suite from the command line?

Ans: java -cp “C:\AutomationReinvented\testng \lib\*;C:\AutomationReinvented\testng\bin” org.testng.TestNG testng.xml


*******************************************************************
For any doubts or career guidance, arrange a 1:1 call with me 


********************************************************************

Learn (API-Microservice)Testing+(CoreJava+UI)-SDET with Self Paced Videos and one LIVE Doubt Session

SDET TRANING VIDEOS AVAILABLE with Live Doubt Session @4500/-(course-1 below,API TRaining Videos With ClassNotes and Coding Set) and 6500/- (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122, 




Entire course content can be found below:  COURSE CONTENT
Check below link for question and answers with code:

Top API Interview Question 1-10

*************************************************

SeleniumWebdriver Automation Testing Interview Questions:

API Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Rest-API

 
Kubernetes Interview Question Set
https://automationreinvented.blogspot.com/search/label/Kubernetes

 
Docker Interview Question Set
https://automationreinvented.blogspot.com/2020/02/top-18-docker-commands-for-aytomation.html

 
Linux Interview question Set
https://automationreinvented.blogspot.com/search/label/Linux

 
Automation Testing/SDET Framework Design
https://automationreinvented.blogspot.com/search/label/FrameworkDesign


Java Related Interview Question Set

https://automationreinvented.blogspot.com/search/label/Java


GIT Interview Question Set:
https://automationreinvented.blogspot.com/search/label/GIT


Coding Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Coding%20Questions

Mobile Testing Interview Question Set:
https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

Python Interview Question Set for QAE - SDET - SDE:
https://automationreinvented.blogspot.com/search/label/Python

No comments:

Post a Comment

All Time Popular Posts

Most Featured Post

API Status Codes with examples for QA-Testers

  🔺 LinkedIn: https://www.linkedin.com/in/sidharth-shukla-77b53145/ 🔺 Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl 🏮In API testing, it...