Key takeaways
- Locators, waits and the close() vs quit() difference are the first things asked in Selenium interviews.
- Prefer explicit waits over Thread.sleep(), and do not mix implicit and explicit waits.
- The notes describe the common Java stack: Selenium, TestNG, Maven and a Page Object Model framework.
- These are original Uncodemy short notes, not official Selenium documentation; check selenium.dev for the current version.
About these Selenium notes
This page offers Uncodemy's Selenium notes as a free PDF. Selenium is a free, open-source tool that automates web browsers through code, and Selenium WebDriver with Java and TestNG is still one of the most common automation stacks in Indian QA teams. The notes are written as short points with command tables and small code lines, so you can revise the whole tool in one sitting before an interview.
Please note: these are original Uncodemy revision notes, not official Selenium or TestNG documentation. Selenium releases new versions often, so check the official documentation for the latest methods and browser support.
What's inside the Selenium notes
The PDF has 8 pages arranged in 8 topic sections, followed by the most asked practice questions and an interview tip. The order follows how you would learn Selenium on the job: setup, locators, waits, element handling, then frameworks. Here is what each section covers.
Testing and Selenium basics
Manual vs automation testing, what to automate and what not to, supported languages and browsers, a table of Selenium IDE, WebDriver, Grid and Selenium Manager, what Selenium cannot automate, and the WebDriver architecture from test script to browser driver.
Setup and first script
JDK, IDE and Maven with the selenium-java and TestNG dependencies, a four-line first script, why WebDriver is an interface, and a table of browser commands ending with close() vs quit().
Locators and WebElements
findElement vs findElements, a table of all eight locators with examples, absolute vs relative XPath with functions and axes, CSS selector patterns, the locator preference order and the main WebElement methods.
Waits and synchronisation
Implicit, explicit and fluent waits compared in a table, a WebDriverWait example, the most used ExpectedConditions, page load timeout, and exceptions such as StaleElementReferenceException and TimeoutException.
Handling web elements
The Select class for dropdowns, alerts, frames, multiple windows and tabs, the Actions class for hover and drag and drop, JavascriptExecutor for scrolling, screenshots, file upload, checkboxes and web tables.
TestNG framework
An annotation table in execution order, @Test attributes such as priority, dependsOnMethods, groups and invocationCount, Assert vs SoftAssert, testng.xml, parallel runs, listeners and the retry analyzer.
Frameworks and Page Object Model
The POM idea and its benefits, a table of data-driven, keyword-driven, hybrid and BDD (Cucumber) frameworks, and the typical Java, Selenium, TestNG, Maven, Git, Jenkins and reporting stack with its folder layout.
Selenium 4, Grid and best practices
Relative locators, the new window API, element screenshots, DevTools access, Grid 4 modes, headless runs with ChromeOptions, and rules for stable, independent tests and finding the cause of flaky tests.
Most asked questions (practice)
Ten interview-style questions, from Selenium components to parallel and cross-browser runs, and a tip on writing a login test with POM and TestNG on a whiteboard.
How to use these notes to learn Selenium
Selenium is learnt by writing scripts, so read a section and then type its examples into your IDE straight away.
- Automate one login page and locate the same fields with id, name, CSS and XPath to feel the difference.
- Replace every Thread.sleep() in a script with an explicit wait and compare the run time.
- Practise one alert, one frame and one new-tab switch on a public practice site.
- Turn your script into two page classes and one TestNG test class to understand the Page Object Model.
A simple three-pass method works well with short notes. In the first pass, read one section and underline only what you do not already know. In the second pass, close the notes and write the locator patterns, wait syntax and TestNG annotation order for that section on a blank sheet, then compare and correct in a different colour. In the third pass, a day or two later, answer two or three interview-style Selenium questions in timed conditions using only memory. Add your own examples and doubts in the margins so the PDF becomes your personal revision copy.
Commands, tables and rules to memorise
- The eight locators and the usual preference order: id, then name, then CSS, then XPath.
- XPath patterns with contains(), starts-with(), text() and the following-sibling axis.
- Implicit vs explicit vs fluent wait, and the WebDriverWait plus ExpectedConditions syntax.
- TestNG order: @BeforeSuite, @BeforeTest, @BeforeClass, @BeforeMethod, @Test, then the After annotations in reverse.
- close() closes only the window in focus; quit() closes every window and ends the session.
Common mistakes that cost you in interviews
- Using absolute XPath copied from browser developer tools; it breaks with small layout changes.
- Mixing implicit and explicit waits, which makes the total wait time unpredictable.
- Forgetting .perform() at the end of an Actions chain.
- Not switching back with defaultContent() or parentFrame() after working inside a frame.
- Fixing flaky tests only with retries instead of finding the timing, locator or data cause.
Interview focus: Selenium topics asked most
Automation testing interviews for freshers usually cover these areas, often with a short coding task on the spot.
- Locators, writing XPath and CSS selectors by hand.
- Waits and common Selenium exceptions.
- Handling dropdowns, alerts, frames and multiple windows.
- TestNG annotations, DataProvider, assertions and the Page Object Model.
Typical interview questions
- What is Selenium? Explain its components.
- What is the difference between close() and quit()? Why is WebDriver an interface?
- Name all locators. Compare XPath with CSS selector, and absolute with relative XPath.
- Explain implicit, explicit and fluent waits.
- How do you handle dropdowns, alerts, frames and multiple windows?
- Explain TestNG annotations and their execution order.
- What is the Page Object Model and what are its benefits?
The depth of questions changes with the role and company. In a hands-on round, write a short login test with a page class and a TestNG test, and explain how you handle dynamic elements, waits and flaky tests.
A 7-day revision plan for Selenium
- Day 1: Testing and Selenium basics, setup and first script.
- Day 2: Locators and WebElements: write ten XPath and ten CSS selectors for one page.
- Day 3: Waits and synchronisation.
- Day 4: Handling web elements: dropdowns, alerts, frames, windows and Actions.
- Day 5: TestNG framework: annotations, groups, DataProvider and testng.xml.
- Day 6: Frameworks and Page Object Model, Selenium 4 and Grid: build a small POM project and run it with mvn clean test.
- Day 7: answer the most asked practice questions at the end of the notes from memory, then write a login test with POM and TestNG on paper in fifteen minutes.
Keep the locator table, wait syntax and TestNG annotation order on one sheet for the last hour before an interview, and do not start a new tool on the final day.
Who these notes are for
- Manual testers moving into automation testing with Java.
- QA freshers preparing for automation testing interviews.
- B.Tech, BCA and MCA students learning software testing tools.
- Java developers who want to write browser tests for their own web apps.
The notes are a revision aid, not a full course. If a topic is new to you, practise it in your IDE first and then use the notes to revise. For interview practice, pair them with the Selenium interview questions page and the Selenium locators cheat sheet. To learn manual and automation testing with a trainer, see the Software Testing course.
Download Selenium Notes PDF
Selenium Notes PDF: WebDriver, Locators, TestNG
The PDF carries the same content as this page in a clean, print-ready layout, so you can read it offline and keep it for revision.
8 pages · 121 KB · PDF · Updated 5 Nov 2026