Selenium Tricky Interview Questions- With Simple Answers

Selenium Tricky Interview Questions


Selenium, in this context, is not in direct association with the chemical element of the same name. It is a computer algorithm made for browsers for testing ends. One of its uses is to automate certain repetitive tasks in the testing process. It is also used to test and confirm any web applications on different browsers and platforms. Here, we’ll know some Selenium Tricky Interview Questions.

A program that is not proprietary. It is free and open-source. By that, it will grow with the help of unpaid but passionate developers in its path of evolution. The software package has achieved the status of being the standard. One of the few for automating and testing web browsers.

Selenium does not refer to one program or test protocol. It is the composition of several functional parts that have grown from its beginnings. It is a suite of programs as it has become. At the present, tracing back a few steps, there are four compartments under the roof. 

IDE (Integrated Development Environment), RC (Remote Control), Web Driver, and Grid. RC and Web Driver has gone into integration to develop into Selenium 2. That integration resulted further and has given an upgrade into Selenium 3. There is a Selenium 4 that has yet to get the approving nod of the majority. 

This phenomenal software started off by necessity. Like any spark of invention, Jason Huggins in 2004 was working at ThoughtWorks. It is a global software company. Jason was tinkering around with codes when he stumbled. 

In the lines of code, he spotted a suspicious recursion. That recursion, if allowed to repeat some time, became a waste of time and resources. It also became less efficient in the recursion process, which they did not want.

Using JavaScript, he made a few lines of coding to ease the itch in his brain. He was aiming to alter that recursion to be more effective than what it was. He gave it a name as “JavaScriptTestRunner.” The events that followed are something you can think by your own.

Interview Questions for Selenium Automation Testers

The job title may not be the same as with other companies. It will be of that sort in any manner. Here are a few questions an applicant will have to prepare for the interview. Before engrossing into that, it is a need to mention that there are different levels in this field.

The entry level is simple and explanatory. Interview questions at this level do not qualify for horror stories. It is at the levels after this that the measure of intelligence are tricky. We do not put a sequence on the order of the questions. This is so since we do not know in any exact manner the framework or the adopted technique of a hiring personnel.

1. What are frameworks? Give me three and expound on them.

Frameworks are a set of rules or code structure to follow in an organized manner. The purpose of which is for better readability of the code and simpler maintenance of the code. There is not one set or structure of frameworks. There are different frameworks to test a web application. The common thing is frameworks break down the code before testing the data set of the test case.

  • Hybrid Testing Framework

As the name shows, this has two options to use. The options are two other frameworks to achieve the testing. These are the Data Driven, and the Keyword Driven. Like Keyword Driven, instructions may be in an external storage file, like in an Excel format. 

The name of the function to invoke will go into a handover to the Java Reflection Class. The passing of function name is like that of Data Driven Framework. Only then can the testing begin or start.

  • Keyword Driven Framework

This is a little similar to Data Driven Framework. There is usage of external source much like Data Driven. Instructions, not the test data, may be in storage outside of the program itself. Retrieval from an Excel or XML file and other file formats will follow. These will have execution on specific functionality of the web application. 

The name of that specific functionality is also in the Excel file, along with the methods of how to do the test. For example, in the “Log In” functionality, a User ID and a password needs verification. The Keyword Driven Framework you might task to find that pair in the internal memory of the web application.

  • Data Driven Framework

This is one of the more famous framework used. For this framework, test data extraction may be from external files. Files such as XML, CSV, a database, Excel, among others. Test data and data set are separate, making it easier to test a small section of the target web application.

The “Log In” function, for instance. To call or invoke “Log In”, Data Driven Framework will pass the function name. A handover to Java Reflection Class occurs to proceed with the test.

A programmer can test this functionality with external data. One may control the test with 20 User IDs and 20 passwords. The tester can also set the parameter with 200 pairs of User IDs and passwords. There are other available techniques within this framework alone.

2. Using Selenium, how do you find broken links on a web page?

A tricky question that is definitely not for any entry-level applicants. About why it is tricky is there is no mention of which of the four Selenium variations has the solution. Second, what function of Selenium will return the result that we want? 

The best known variation to solve this computing problem is Selenium WebDriver. This is useful even if there are a hundred links on a page (which is very rare). The process under Selenium WebDriver can check each of these links and reported. Not directly, if that is not fortunate enough. There are two other procedures to follow to call the essential function. That function will reveal the broken links in a web application.

First to do is to identify all the links on the web page. To do that, we use the “anchor” tag. Once tagged, each of the hyperlinks undergoes an attribute identification with the ‘href’ function. Only then will these tagged and attributed hyperlinks go under the testing. Test will be by WebDriver’s driver.get() method. The result will show a broken link or not.

3. testing.xml, how significant is this?

There are limitations yet for Selenium. It can not do test case management and report generation. To augment this deficiency, we use TestNG with Selenium WebDriver.

Testing.xml is in the fold of TestNG. This is a type of .xml file where all the test cases are in store. Along with these are the methods you want to execute for the testing itself.

4. What is a soft assertion and how do you mark a failed test using this?

TestNG has a range of functional modules on its own. It also has a customized error handling exception function. This is soft assertion. Like most of the functions of Selenium, this is another one step function. It has one thing to perform only. But coupling it with another function may continue the execution of the testing.

Soft assertion, by itself, does not mark any test as failed. It has to couple itself with another function, assertAll to do so. If not done in this manner, soft assertion will continue to the next execution. The function will not mark any failed test.

5. Synchronization is achievable where and how​?

Synchronization is achievable only in Selenium WebDriver. It is a multi-component mechanism that needs the components to work in a parallel fashion. There are two types the automation tester to choose from according to the situation.

  • Conditional Synchronization. Unlike Unconditional Synchronization, there is an addition of a condition. This will need not only the variable timeout to know how much time it needs to pass over. It will also need a certain condition that must qualify to proceed to the next execution. If timeout expires and no realization of the condition happens, the testing stops with reports after.  
  • Unconditional Synchronization. In this type, there is only one variable, timeout. This is to make the tool pause for a specified certain amount of time. Once lapsed, further execution of any procedure goes into carrying out. The waiting time will make it in sync with what it has to be in sync with.

6. What are DOM and POM in Selenium?

DOM in its full form is Document Object Model. POM, meanwhile, is Page Object Model. POM is for test automation by Selenium. DOM is more functional in creating content for websites. It may also be a reference point for testing with Selenium. The interest in DOM is it is an open-source created by web developers. It is in standard with the W3C (World Wide Web Consortium).

7. What are the unique exceptions that may arise in the execution of Selenium? Explain one or two of these.

There are many exceptions that may happen in a Selenium event execution. Exceptions are messages by the computer or by the computer program running on the machine. This message of exception tells of some level of error in the program’s execution.

Exceptions that may happen in Selenium execution could be:

  • WebDriverException
  • StateElementReferenceException
  • IllegalStateException
  • TimeoutException
  • ElementNotVisibleException
  • NoAlertPresentException
  • NoSuchWindowException
  • NoSurfElementException

StateElementReferenceException: This error message happens in one of two events. The element in the search is not anywhere in the web application under testing. It could also happen when the element is no longer attached to the DOM (Document Object Model). 

Selenium Tricky Interview Questions- With Simple Answers

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top