Selenium Tips & Tricks

https://practicetestautomation.com/practice-test-login/ Comparison Differnt Versions of Selenium 1 2 3 4 5 6 7 8 9 10 11 12 // Selenium 2, 3 (Manual driver setup) System.setProperty("webdriver.chrome.driver", "C:\\drivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); // Selenium 4.0 – 4.5 (Using external WebDriverManager) import io.github.bonigarcia.wdm.WebDriverManager; WebDriverManager.chromedriver().setup(); WebDriver driver = new ChromeDriver(); // Selenium 4.6+ to 4.38 (Built-in Selenium Manager — current) WebDriver driver = new ChromeDriver(); // No setup needed Best Practices 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // Window management driver.manage().window().maximize(); // Cookies driver.get("https://www.google.com"); driver.manage().addCookie(new Cookie("TestCookie", "12345")); // Timeouts — Best Practice driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10)); // for element search driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(20)); // for full page load driver.manage().timeouts().scriptTimeout(Duration.ofSeconds(10)); // for JS scripts // Example: delete old cookies at start driver.manage().deleteAllCookies(); driver.manage() – Overview Category Common Methods Purpose Window maximize(), minimize(), fullscreen(), setSize(), setPosition() Control browser window Cookies getCookies(), addCookie(), deleteAllCookies() Manage session cookies Timeouts implicitlyWait(), pageLoadTimeout(), scriptTimeout() Control how Selenium waits for operations Timeouts — driver.manage().timeouts() Method Description implicitlyWait(Duration time) Wait for elements to appear pageLoadTimeout(Duration time) Max time to wait for page to load scriptTimeout(Duration time) Max time for asynchronous scripts (JS) Sample Test Case You are a Selenium Java expert. I need to automate a simple task: ...

November 6, 2025 ·  (Updated: February 19, 2026) · 2 min · 217 words · FewSteps
Read More

Key Java Comparisons: Collections & Concepts

Java Collections and Key Programming Comparisons This document provides a comprehensive comparison of Java collections, interfaces, classes, and key programming concepts. 1. HashMap vs. Hashtable Feature HashMap Hashtable Synchronization Non-synchronized; not thread-safe without external synchronization. Synchronized; thread-safe by default. Nulls Allows one null key and multiple null values. Does not allow null keys or values. Version Introduced in JDK 1.2 (new class). Legacy class. Performance Fast. Slower. Synchronization Option Can be made synchronized with Collections.synchronizedMap(hashMap). Internally synchronized; cannot be unsynchronized. Traversal Uses Iterator. Uses Enumeration and Iterator. Fail-Fast Behavior Iterator is fail-fast. Enumerator is not fail-fast. Inheritance Inherits AbstractMap. Inherits Dictionary. 2. ArrayList vs. LinkedList Both implement the List interface and maintain insertion order. Both are non-synchronized classes. ...

February 11, 2026 ·  (Updated: February 18, 2026) · 3 min · 523 words · FewSteps
Read More

Complete Java Interview Prep Sheet

Complete Java Interview Prep Sheet (Final Version) 1. Core OOP Concepts 4 Fundamental Principles: Abstraction: Hide implementation details, show only essential features (abstract classes/interfaces). (what to implement). Encapsulation: Bundle data + methods, hide internals using private fields + public getters/setters (data hiding). Inheritance: Child class acquires parent class properties (is-a relationship, single inheritance only). Polymorphism: Same interface, multiple forms (compile-time: method overloading; runtime: method overriding). Key Points: Java not pure OOP (uses primitives, no multiple class inheritance). Object class is root of all classes: equals(), hashCode(), toString(), wait()/notify(). Multiple inheritance via interfaces only (no diamond problem). 2. Java Basics Class/Object/Method: ...

February 11, 2026 ·  (Updated: February 18, 2026) · 3 min · 618 words · FewSteps
Read More