Selenium WebDriver Interview Questions

SELENIUM WEBDRIVER INTERVIEW QUESTIONS

You have been learning test automation with Selenium WebDriver for some time.

You are wondering if you are ready for interviewing for a test automation job.

How can you know if you are ready or you need to learn more?

You can take practical tests (see this link for an example) to assess the level of your knowledge and skills.

You can also go through possible interview questions to find what you dont know yet.

Personally, I dont think that interview questions are useful for taking the interview at all.

But they can help you find what you dont know and should know.

The following list is not complete and it can be improved.

It focuses on testing your practical Selenium WebDriver skills and less on theoretical knowledge.

For some of the questions, I have added links to articles that provide explanations and useful information.

If you have ideas of other Selenium WebDriver interview questions, please leave them in the comments.

 

EXPLICIT WAITS

  • What can an explicit wait be used for?
  • What is the difference between driver.findElement() and wait.until(ExpectedCondition.visibililityOfElementLocated(locator))
  • What are fluent waits?

LOCATORS

  • When should  you use XPATH locators? When should you not use them?
  • What are the best element locator types?
  • How do you find an element that is included in a frame?
  • How do you test an XPATH expression in Chrome?
  • How do you get the previous, next, parent node?

  • What selectors cannot be done with css selectors?

  • How do you test xpath expressions in IE?

SELENIUM WEBDRIVER ARCHITECTURE

  • What are the differences between the Chrome, IE and Firefox drivers? Where can you find these drivers?
  • What is the difference between ChromeDriver and headless browsers?
  • Why do test scripts execute fastest using Html Unit Driver?

  • How is the Html Unit Driver different from Phantom JS? Which one is better to use?

PAGE OBJECT MODEL

  • Explain how the page object model works. See this article.
  • What is a page component?
  • How can you create fluent methods for the page object classes? For example, resultsPage.changeSortOrder().filterResults()?
  • How does a Page Factory work?
  • Why do you need Page Objects?
  • What is the difference between page object and page element?

UNIT TESTING

  • How do you make test scripts dependent in Test NG? See this article.
  • What is the difference between @Before and @BeforeClass in JUNIT?
  • How do you remove the setUp() and tearDown() methods from the test class?
  • How do you run only the high-priority test scripts?
  • How does test driven development work? See this.
  • What are typical things that can be done in the setUp() method?
  • How do assertions work? See this.
  • Why is unit testing important for test automation? See this.
  • How do you execute the failed test cases in JUNIT and TestNG

  • Why do you need junit rules in test automation?

  • How do you use the test class and test scripts names in test scripts?

  • How do you display the name of each executed script in a log file?

FRAMEWORK

  • How do you create the web driver object in the framework?
  • How do you structure the framework?
  • How do you isolate Selenium WebDriver API code from the page object classes?
  • How do you implement navigation for a site?

MAVEN

  • How do you run test scripts in Command Prompt?
  • How do you run test scripts in parallel? Read this.
  • How is Jenkins? How does it work?
  • What happens when you run mvn test?

  • What is the difference between a maven build phase and goal?

JAVA

  • What is the difference between an abstract class and an interface?
  • How does polymorphism work?
  • What is the difference between inheritance and composition?

  • When do you use composition in test automation?

  • How do you read test data from CSV files? Read this.

SELENIUM WEBDRIVER LIBRARY

  • How do you generate reports for your test scripts? See this article.
  • How do you do cross browser testing with Selenium WebDriver? See this article.
  • How do you make Selenium WebDriver scripts faster? Read this article.
  • How do you run test scripts in parallel? Read this.
  • What should you not have in a test script?
  • How do you run scripts on a headless browser?
  • What test cases should you automate with Selenium WebDriver?
  • What test automation good practices do you know?
  • How do you check that an element is no longer visible?
  • How do you check that an element is no longer in the browser dom?
  • How do you interact with sliders?
  • How do you get the rows of a table embedded in another table without using xpath? assume that the web page includes just 2 tables, the second included in the first one
  • How do you select a listbox option? Provide 2 different ways
  • Why do you need the DesiredCapabilities class?
  • When do you use the RemoteWebDriver class?
  • What is the slowest Selenium WebDriver command?
  • How do you make test script to run in Internet Explorer?
  • What does driver.close() d0?
  • Provide 2 ways of asserting that the title of a page is correct
  • How do you ignore 3rd party requests in a Selenium script?

  • When and how do you use the Actions class?

  • How is a page displayed in the browser?

  • How do you take a page screenshot in case of error?

  • How do you check if a text is included in an element?

  • How can you click an element without using findElement() and click()?

  • How do you deal with the StaleElementReferenceException?

  • How do you check that the server response code for a web page is 200?

2 Comments

  1. Amazing, thanks a lot my friend, I was also siting like a your banner image when I was thrown into Selenium.When I started learning then I understood it has got really cool stuff.

    Like

    Reply

  2. .Salaam,

    I love all the posts, I really enjoyed.
    I would like more information about this, because it is very nice., Thanks for sharing.

    I need your guide in my new project, i don’t have lot of experience on image handling,

    I am trying to custom graphic class..,

    My task is to replace the specific area color of the image when i select the area & pick the color..,

    If i choose the hand / body of the T-shirts means the color can change by the user..,

    Follow my new blog if you interested in just tag along me in any social media platforms!

    Obrigado,
    Irene Hynes

    Like

    Reply

Leave a comment