This document provides guidance on how to prepare for Selenium WebDriver interview questions. It lists the top 15 commonly asked Selenium interview questions and provides sample answers. Some of the questions focus on frameworks, challenges faced, test automation metrics like number of test cases automated per day, and how to debug failures. The document recommends having knowledge of tools like TestNG, frameworks like page object model, and techniques like parallel testing and logging to effectively answer interview questions.
This document provides guidance on how to prepare for Selenium WebDriver interview questions. It lists the top 15 commonly asked Selenium interview questions and provides sample answers. Some of the questions focus on frameworks, challenges faced, test automation metrics like number of test cases automated per day, and how to debug failures. The document recommends having knowledge of tools like TestNG, frameworks like page object model, and techniques like parallel testing and logging to effectively answer interview questions.
Q1. Which framework you worked on? Generally people talk about all types of frameworks they have studied. But in my opinion there is no need to mention that. You should speak about the framework you are good in. If you think you are confident about Page Object, then just focus on that. Another approach is to look at the job description. If the job description says Cucumber, then prepare yourself for that.
When you talk about the framework, please talk about the some advantages of the framework and why we should use that framework. Talk few lines about how it can be helpful.
Q2. What challenges you faced in Framework implementation? You can also that timing issues, also known as browser synchronization was a challenge and you over came it with efficient and proper use of Explicit Waits. You can also mention that, maintaining Xpath was also a challenge, and you overcame this by collaborating with developers and asked them to add a test-id for automation. This test id stays static even if the DOM structure changes.
You can say, that one of the biggest challenges was to come up with the proper structure and library implementation. Because we need to make sure that the libraries we implement are flexible to fit our needs and meet any challenges we may face in future. It gives a very good impression if we talk about future issues, as it tells the interviewer that you are considering upcoming challenges while designing a framework. You can talk about that we may need integration with other 3rd party tools with Selenium WebDriver and for this we need to have separate classes, which can plug into the framework easily.
Now, let's talk about what you should know and what should not do: When you are creating your page libraries or other classes, you should understand why you are declaring a variable as static or non-static. You should understand why you are declaring them as private vs public. Because in future if you need to make changes, it will be very difficult for compatibility with the places they are already used.
You should try to avoid all the hard coding as much as possible. Put configuration in external files, so that they can be modified without having a need to change the code.
Q3. What source code management tool you have work with? Source code management tool is nothing but a tool, which is used to store/manage the code files. Some examples are Git, TFS, and SVN.
If you do not have real time experience, let's say you have worked on your own and designed a good framework. If you have not worked in a team then chances are, that you may have not checked-in your code at some place. It is very important when we work in teams because multiple people may make changes to the same file.
I would suggest you to use GitHub; you can create a free account and check-in your code there. This will give you some experience of working with source code management tool. This is not a major question; they are just trying to understand if you have worked with some source. If you have worked with one tool, then it is not difficult to work with other tools also.
Q4. How many team members are there in your team? If you have not worked, you may say a random number like 6 members. You should approach this question by explaining the structure of the complete team, not just testers. You can say, in my team there are 6 members and out of that 2 testers. We follow agile methodology, so a tester is responsible for functional testing and automation as well.
Q5. How many test cases did you automate in a day? In my opinion this is one of the weird questions. In real time there is no specific number you can give. There are days when you don't automate a single test case because you may be working on Page Libraries. There are days when you can automate 4-5 test cases if they are small, then there are days when you may automate only 1 or 2 test cases because they are complex.
Give these examples in the interview. Say, that it depends on scenarios and it also depends on how much framework is complete which is usually not the case because you will write page libraries at the time you write test methods. It is not possible to correctly complete page libraries without looking at the test cases.
Q6. How many test cases you automated overall? This is a little less weird question than the previous one. Previously we discussed how many test cases in a day, this is a question about how many test cases overall. This also does not have a specific answer; it depends a lot on the type of test cases written. One kind of approach can be 1000s of small test cases while other approach can be few hundreds of big workflows, which includes multiple small scenarios. We need to understand the purpose of automation. When we develop a feature, and start automating it is always manually tested in the process of automating also because we need to understand the feature to be able to correctly automate it. Automation comes in handy when we have next releases, because for old features it is not possible to run every single test case from old features and this is known as Regression Test Suite. This is where we run automation to make sure that existing functionality is not broken because of new features or changes in the next release.
Keeping all of this in mind, you can come up with a number. If you have worked in a company for long time, you can say you can say a bigger number like 1000 - 2000 test cases, if you worked for a short time you can say about 100 - 200.
Q7. How many browsers you have covered in automation execution? You can say major browser names, like FF/Chrome/Safari/Edge at the max. Don't say 5 - 10 browsers, different versions of browsers and do not come up with a long list. If you work in real time, you will notice tests are executed in mostly in one or two browsers. For this we need to understand the purpose of automation and types of issues that may show up in different browser.
Usually look and feel type of issues related to positioning of elements and CSS happen in different browsers. And we use Selenium WebDriver for functional automation, not for look and feel. If a functionality of the website is working on one browser then chances are it will work on other browsers also. If functionality is broken on one browser then chances are it will be broken on other browsers also. There are very few cases when functionality works on one browser but does not work on other browser. In industry, everything is done with ROI in mind. ROI is return of investment which means what is the return you are getting for the investment of the effort you need to do to run and maintain automation suite on multiple browsers. If the return is not worth then it cost a lot to maintain that effort. Only few organizations run test automation on more than 2-3 browsers.
Q8. How did you run automation in 2-3 browsers? You can say that, we use Selenium Grid to run automation on different browsers. We used virtual machines to deploy the hub and nodes. In many companies, they don't even use Grids; instead they execute tests on a single VM on a single browser at a time.
If you are not very confident about using Grid, then you can say we have scheduled Jenkins Jobs for different browsers. Example: Automation runs on FF on Monday and Chrome on Tuesday. Likewise by running on alternate days, we cover multiple browsers.
Q9. Which OS you covered for automation execution. If you actually covered multiple OS, then you can mention them. If you have not worked on multiple OS, then always says Windows as this is still the most common OS and most of the testing for browsers happens on Windows.
Q10. Which framework have you used to execute test cases? This is just another term for how to run our test cases. You can mention either TestNG or JUnit whichever you feel comfortable about. Then you can mention that I used to run the automation from a Jenkins job using TestNG XML files or in-fact a Maven project which has TestNG XML file in the Maven's pom.xml file.
Q11. How long your automation execution takes to complete and how you reduced the time? This is nothing but a different sentence trying to ask if you used any parallel testing. There is no specific time for execution time; you can say any number less than 1 hour for a sanity test suite and anywhere more than 2 hours to 10 hours for a regression test suite. Then you can say, I used TestNG's parallel feature to run tests in parallel to reduce the time.
Q12. If there is a failure how do you make sure that it is not an intermittent failure? They are trying to ask, if you know about TestNG's retry capabilities. When we run a TestNG suite, it creates a testng-failedtest.xml file in the test-output folder. If we run that XML file then it will run only the failed test cases, and we can save time by not running all the test cases. If the test cases are successful this time, then we can say they were intermittent issues otherwise we can say they are real issues. There is an automatic feature also which is retry listener in TestNG which will take care of running the failed test cases in a TestNG suite.
Q13. How do you debug failed test cases? You can say that, we can look at the logs and screenshots to debug failed test cases.
Q14. How do you perform logging and how you take screenshots. You say we that I have used Log4j2 for logging purposes. We can have the Log4j2.xml file configured, which determines the format of the logs and name of the file. And we can use TestNG listeners for taking the screenshots. In onTestFailure method, we can write code to take screenshots. This method is present in ITestListener class. You can also explain that this method will only execute if there is a test failure and hence we take screenshots only for failed test cases because this is what we need for debugging. We do not want to store screenshots for successful test cases because storage is expensive and we do not want to look at unnecessary data while debugging.
Q15. Why we should use Selenium WebDriver over other tools? • Free and Open Source Large user Base and big community support • Support many languages • Cross browser support • Compatible with multiple platforms
Next Steps for YouTube viewers:
Learn all concepts in more detail with lifetime access to all the courses. Best is class support is provided to questions within 24 hours. That’s our promise and this is why people rely on us.
Selenium WebDriver With Java Course (Only $9): https://learn.letskodeit.com/p/selenium-webdriver-with- java/?product_id=342636&coupon_code=YOUTUBESELJAVA9
Selenium WebDriver With Java and Python (Only $19 Bundle): https://learn.letskodeit.com/p/selenium-webdriver- bundle/?product_id=346466&coupon_code=YOUTUBESELENIUM19
All Courses Bundle – Includes Future Courses (Only $29): https://learn.letskodeit.com/p/complete-software- bundle/?product_id=443190&coupon_code=YOUTUBERSONLY29