Java + Selenium – Last Minute Interview Revision
Quick, high■yield notes covering core concepts frequently asked in interviews.
1. Core Java (Must■Know)
● OOPs: Encapsulation, Inheritance, Polymorphism, Abstraction (real■time examples).
● Access modifiers: private, default, protected, public.
● Collections: List, Set, Map – ArrayList vs LinkedList, HashMap vs TreeMap.
● Equals() vs ==, HashMap internal working (hashing, collisions).
● Exception handling: checked vs unchecked, try■catch■finally, throws vs throw.
● Java 8: Lambda, Functional Interfaces, Streams, Optional.
● Immutable class, String vs StringBuilder vs StringBuffer.
2. Selenium Basics
● WebDriver architecture: Client → JSON Wire / W3C → Browser Driver → Browser.
● Supported browsers: Chrome, Firefox, Edge, Safari.
● Locators: id, name, className, tagName, linkText, partialLinkText, CSS, XPath.
● CSS vs XPath – performance, when to use which.
3. XPath & CSS Selectors
● Absolute vs Relative XPath.
● Common XPath functions: contains(), starts-with(), text().
● Axes: parent, child, ancestor, descendant, following, preceding.
● Dynamic XPath handling for changing attributes.
4. Important WebDriver Commands
● Browser: get(), navigate().to/back/forward/refresh().
● Element: click(), sendKeys(), clear(), getText(), getAttribute().
● Validation: isDisplayed(), isEnabled(), isSelected().
● Window handling: getWindowHandle(s), switchTo().window().
5. Waits (Very Important)
● Implicit Wait – global, not recommended for dynamic apps.
● Explicit Wait – WebDriverWait with ExpectedConditions.
● Fluent Wait – polling frequency + exception handling.
● [Link]() – avoid in real frameworks.
6. Advanced User Interactions
● Actions class: mouse hover, drag■and■drop, double click.
● Keyboard actions using Keys class.
● Handling alerts: accept(), dismiss(), getText().
● Frames & iframes: switchTo().frame(index/name/WebElement).
7. Dropdowns, Windows & Tabs
● Select class: selectByVisibleText, selectByValue, selectByIndex.
● Handling multi■select dropdowns.
● Switching between multiple windows/tabs.
8. File Upload & Screenshots
● File upload using sendKeys(filePath).
● AutoIT / Robot class for OS■level dialogs.
● Taking screenshots using TakesScreenshot.
9. TestNG / JUnit (Interview Focus)
● Annotations: @BeforeSuite/Test/Class/Method, @Test, @After*.
● TestNG attributes: priority, dependsOnMethods, groups, enabled.
● Assertions: Hard vs Soft Assert.
● DataProvider vs Parameterization.
10. Framework Design Concepts
● Page Object Model (POM) – separation of test & UI logic.
● Page Factory – @FindBy, lazy initialization.
● Data■Driven, Keyword■Driven, Hybrid frameworks.
● Maven project structure & dependencies.
11. CI/CD & Best Practices
● Running tests via Maven (mvn test).
● CI tools: Jenkins basics.
● Headless execution.
● Cross■browser testing using Grid / cloud tools.
● Common Selenium challenges & solutions.
Tip: Be ready with real project examples for waits, XPath, framework design, and debugging failures.