TESTEROPS

A pragmatic approach to QA and OPS

Selenium Questions – TYPICAL

This is a collection of interview questions that are not commonly asked when going for an interview. These questions are taken from problems that I/my team have actually faced while working with Selenium.

In order to people to have a code-first view of the solutions, I have this repo, where you can find the solutions to these problems.

The code in the repo listed above is in Python, although it would be common and almost same in other bindings too. We have use Selenium 4 ( already released in Production at the time of writing), with PyCharm IDE for this code.

  • How do you handle multiple levels of shadow DOM inside a web app that you are testing with Selenium?

We’ll create one function – that will expand the parent shadow-dom tree

Upon calling on multiple iterations on the nested shadow-dom elements, this will expand the parent shadow-dom,
and then try to find any element if we want inside it and then perform any action on that element.

  • Let’s say we have a page where there is an auto-scroll functionality. How can you write a method using Selenium so that the scroll works until the last record ? How will you stop the scroll?

  • Consider the following structure

– Main Window

Iframe 1

Iframe 2

User performs some action inside frame 2

In this scenario, how do a user returns to

– Main Window

– Iframe 1

  • How to ignore a SSL certificate change error in Chrome using Selenium

  • What are Pseudo-elements? How can we handle them using Selenium?

  • What are the options of re-sizing the browser window in Selenium?

  • Can I minimise a browser window in Selenium?

  • When running Selenium in headless mode, a lot of the times we see people using these flags

–no-sandbox

–disable-shm-usage

Do you know what does these flags mean?

  • How to send multiple whitespace characters in a single sendkeys statement in Selenium?

  • Selenium 4 has been released. What are the new locators being talked about in Selenium 4?

  • Have you ever implemented your Selenium code in Docker? Can you give an example?

  • Have you heard of Allure reports? Have you integrated allure reports in Selenium?

  • Can we interact with Chrome devtools in Selenium?

  • How can you test a new Chrome extension using Selenium?

  • Tell me about Screenshots in Selenium? How are they useful? A little bit about the implementation.

  • Is it possible to find the cursor of the currently focussed element in the web page?

  • Recently Selenium 4 was released. In Selenium 4 we can mock geo-location? Do you know how we can do that?

  • What is localisation testing? How can we do localisation testing using Selenium?
%d bloggers like this: