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

SQL Interview Preparation Guide: Master Core Concepts and Queries

1. INNER JOIN and NATURAL JOIN are not the same**. NATURAL JOIN is an implicit INNER JOIN based on matching column names. INNER JOIN is explicit and safer, so it is preferred in practice. 👉 Always use INNER JOIN INNER JOIN → You tell SQL how to join NATURAL JOIN → SQL guesses how to join 2. Key SQL terminology and core concepts Aliases Aliases rename columns or tables in a query to make results clearer or queries shorter. Column alias: SELECT COUNT(*) AS total_students (uses AS). Table alias: FROM students s [no AS (for Oracle) for the table in many dialects] (best avoid AS). Relationship types One‑to‑one: one row relates to exactly one row in another table [e.g., one teacher (teaches)→ one subject]. One‑to‑many: one row relates to many rows [e.g., one teacher (teaches) → many students]. Many‑to‑many: many rows on each side relate to many on the other [e.g., many students (enrolled in) → many courses]. UNION vs UNION ALL UNION: Combines (stacks) results from multiple SELECT statements. Requires same number of columns, compatible data types, and same column order. Removes duplicate rows (implicit DISTINCT). May be slower due to duplicate removal (sorting/hash) UNION ALL: Same structural requirements as UNION. Keeps duplicates; generally faster [than UNION (no duplicate check)]. Extra Note: INTERSECT: Common rows MINUS / EXCEPT: Rows in first query not in second 1 2 3 4 5 6 7 8 9 -- Using UNION (duplicates removed) SELECT city FROM customers UNION SELECT city FROM suppliers; -- Using UNION ALL (duplicates kept) SELECT city FROM customers UNION ALL SELECT city FROM suppliers; Main clauses in a SQL query Common main clauses: SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY. Typical logical order you write: SELECT … FROM … WHERE … GROUP BY … HAVING … ORDER BY …. Only SELECT and FROM are mandatory Actual order of execution Logical execution order: FROM – choose tables / joins. [where data is coming from] WHERE – row‑level filtering. [what is returned] GROUP BY – create groups. [how data is grouped] HAVING – filter groups (often on aggregates). [which characteristics] SELECT – project columns / expressions. [what data is returned] ORDER BY – sort result. Constraints A constraint controls what data is allowed in a table. Common constraints: primary key, foreign key, UNIQUE, NOT NULL. Aggregate functions (Used with GROUP BY, Aggregate functions are allowed only in HAVING.) SUM() – returns total. AVG() – average. MIN() – smallest value or oldest date. MAX() – largest value or newest date. COUNT() – number of values (or rows when using COUNT(*)). Categories of SQL commands DDL (Data Definition Language): defines/changes table structure and objects such as databases, tables, views, and indexes (CREATE, ALTER, DROP. TRUNCATE). DDL commands usually auto-commit. Exmple: CREATE DATABASE, CREATE TABLE. DML (Data Manipulation Language): changes data (INSERT, UPDATE, DELETE). DML commands are transaction-controlled (can be committed or rolled back). Example: INSERT INTO. DCL (Data Control Language): Controls access and permissions on database objects (GRANT, REVOKE). Typically handled by DBAs. TCL (Transaction Control Language): manages transactions (BEGIN / START TRANSACTION, COMMIT, ROLLBACK, SAVEPOINT). DQL (Data Query Language): querying data (primarily SELECT, along with clauses like WHERE, ORDER BY, GROUP BY, HAVING, and LIMIT). 3. Creating, seeding, and modifying tables Creating a table Think through: table name, columns, data types, NULL vs NOT NULL, constraints (PK / FK), identity/auto‑increment. Example pattern (SQL Server style): 1 2 3 4 5 6 CREATE TABLE employee_info ( id INT NOT NULL IDENTITY(1,1) PRIMARY KEY, first_name NVARCHAR(75), last_name NVARCHAR(75), email NVARCHAR(125) ); Use comments (--) to describe purpose of each block; this helps in written interviews. Inserting (seeding) data Pattern: 1 2 INSERT INTO employee_info (first_name, last_name, email) VALUES ('John', 'Arthur', 'john.arthur@example.com'); When the id column is identity/auto‑increment, you omit it from the column list. Verify with: SELECT * FROM employee_info;. ALTER – changing table structure Purpose: alter structure/relationships, including adding, dropping, or changing columns. Drop a column: 1 2 ALTER TABLE employee_info DROP COLUMN email; Add columns (can add multiple at once): 1 2 ALTER TABLE employee_info ADD city NVARCHAR(100), department NVARCHAR(100); Change data type of a column: 1 2 ALTER TABLE some_table ALTER COLUMN country NVARCHAR(100); 4. TRUNCATE vs DROP (and constraints) TRUNCATE TRUNCATE TABLE table_name removes all data but keeps the table structure (columns and their constraints remain). Often faster than DELETE without a WHERE clause. Cannot truncate a table that is referenced by a foreign key constraint; you must drop or disable the constraint first. Handling foreign key constraints If TRUNCATE fails due to a foreign key, you: ALTER TABLE child_table DROP CONSTRAINT fk_name; Then TRUNCATE TABLE parent_table;. You typically find fk_name in the database’s key/constraint metadata. DROP DROP TABLE table_name removes the table structure and all data. ALTER TABLE table_name DROP COLUMN column_name removes just one column. Think of TRUNCATE as clearing rows, and DROP as demolishing the table (or column). 5. Logical/comparison operators and wildcards Core keyword operators BETWEEN – values in a range (inclusive). IN – values in a specific list. LIKE – pattern matching (commonly with wildcards). IS NULL / IS NOT NULL – test for nulls. EXISTS – checks if a subquery returns any rows. Wildcards (used with LIKE) % – any number of characters (including zero). Example: WHERE name LIKE '%AMES' returns anything ending in “AMES”. _ – exactly one character per underscore. Example: WHERE code LIKE '_2_6' matches patterns like A2B6. [] – one of the characters inside the brackets. Example: WHERE name LIKE 'Wi[lk]%' matches “Will…”, “Wik…”, etc. Practice patterns with LIKE Return emails with any characters before 6 and ending in @gmail.com: 1 2 3 SELECT first_name, email FROM some_table WHERE email LIKE '%6@gmail.com'; Exclude first names with exactly one character followed by “ar” then anything: 1 WHERE first_name NOT LIKE '_ar%'; First name starting with B followed by I/R/O and any characters, and city with no “UL” anywhere: 1 2 WHERE first_name LIKE 'B[IRO]%' AND city NOT LIKE '%UL%'; 6. IN and BETWEEN in practice IN – simplifies multiple equality checks: 1 2 WHERE shirt_size IN ('M', 'L', 'XL', 'XXL') ORDER BY shirt_size ASC; BETWEEN – range on numbers, dates, etc. (inclusive of endpoints): 1 WHERE dress_size BETWEEN 2 AND 16; Combine with functions like DATENAME to extract parts of dates: Birth month: DATENAME(MONTH, birthday) AS birthmonth. Birth year: DATENAME(YEAR, birthday) AS birthyear. Example: people with dress size 2–16 and pant size containing L, ordered by birth month: 1 2 3 4 5 6 7 SELECT first_name, pant_size, DATENAME(MONTH, birthday) AS birthmonth FROM friends WHERE dress_size BETWEEN 2 AND 16 AND pant_size LIKE '%L%' ORDER BY birthmonth; 7. COALESCE and its relation to CASE COALESCE COALESCE(expr1, expr2, …) returns the first non‑null expression; if all are null, returns null (or the last specified default). Classic use: replace nulls with a default value in a result set. 1 2 3 4 SELECT first_name, favorite_color, COALESCE(shirt_size, '4XL') AS shirt_size_filled FROM company_shirts; Existing non‑null values are preserved; only nulls get the default replacement. Equivalent CASE pattern The same logic can be expressed with a CASE expression: 1 2 3 4 5 6 7 SELECT first_name, favorite_color, CASE WHEN shirt_size IS NULL THEN '4XL' ELSE shirt_size END AS shirt_size_filled FROM company_shirts; CASE is more human‑readable and flexible but more verbose; COALESCE is succinct but slightly less explicit. 8. Quick revision checklist for interview Use this as a rapid checklist when revising: ...

January 29, 2024 ·  (Updated: February 17, 2026) · 9 min · 1851 words · FewSteps
Read More

Java Mastery: From Basics to Advanced OOP

Mac Java Installation Steps Download and Install Java Check installed JDKs /usr/libexec/java_home -V [for Mac] java -version [for Windows] Open .zshrc and set JAVA_HOME vi ~/.zshrc [using terminal] export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home [add this] esc → :wq [Save and exit] Save and reload shell config in terminal source ~/.zshrc Check Java HOME is setup properly from terminal echo $JAVA_HOME Windows Java Installation Steps Download and Install Java Check installed JDKs java -version [for Windows] Set JAVA_HOME Environment Variable Open System Properties → Advanced → Environment Variables Under System variables, click New and add: Variable name: JAVA_HOME Variable value: C:\Program Files\Java\jdk-17 [or your JDK path] Click OK to save Update PATH Variable In the same Environment Variables window, select Path → Edit → New, then add: %JAVA_HOME%\bin Click OK to save and close Verify Configuration in Command Prompt java -version echo %JAVA_HOME% Class-level/Instance variables/field + Local Variable 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 public class Car { String brand; // Class-level/Instance variables/field (each Car object has its own copy) int year; static int wheels = 4; //Static variable (shared by ALL Car objects) public Car(String brand, int year) { // Constructor (sets instance variables) this.brand = brand; this.year = year; } public void displayInfo() { // Method with a local variable String info = "Car Brand: " + brand + ", Year: " + year + ", Wheels: " + wheels; // Local variable (exists only while this method runs) System.out.println(info); } public static void main(String[] args) { Car myCar = new Car("Toyota", 2022); // Local variable in main() myCar.displayInfo(); // Calling instance method using the object System.out.println("All cars have " + Car.wheels + " wheels."); // Accessing static variable Car anotherCar = new Car("Honda", 2020); // Creating another car to show that static variable is shared anotherCar.displayInfo(); } } When to use static You’d only make it static if the method doesn’t depend on any specific object’s data. For example: public static void showWheelsInfo() { System.out.println(“All cars have " + wheels + " wheels.”); } This one is static because it only uses the wheels variable — which is also static — and doesn’t need to know about a specific Car object. Perfect! Here’s your fully formatted version with bold definitions and added emojis for each concept to make it visually pop: ...

November 6, 2025 ·  (Updated: February 18, 2026) · 11 min · 2183 words · FewSteps
Read More

Humanizing AI YouTube Scripts

Final Prompt You Can Use 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Rewrite the text below as a natural, casual script for a voiceover. The goal is to sound human and conversational while increasing “burstiness” and “perplexity” in a realistic way. Rules for style: - Mix very short, punchy lines with longer, more detailed ones. - No “AI Openings”: Do not say “Welcome back” or “In today’s video.” Start with a punchy sentence. - Use casual transitions like “Anyway,” “So,” “Look,” or “Check this out.” - Use plenty of contractions (don’t, it’s, you’re). - Avoid corporate or academic-sounding words. If a sentence feels too perfect or stiff, break it up or roughen it slightly. Rules for audio formatting: - Use ellipses (…) to mark natural pauses or breaths. - CAPITALIZE words you want to emphasize. - Keep everything as spoken lines only (no bullet points, no headings, no explanations). - Do not add any commentary before or after the script—output the script only. Text: [INSERT TEXT] Rewrite the text below as a natural, casual script for a voiceover. The goal is to pass high-level AI detection by maximizing ‘burstiness’ and ‘perplexity.’ > Use a mix of short and long sentences. Use slang or casual transitions like ‘Anyway,’ ‘So,’ or ‘Check this out.’ Use plenty of contractions. Avoid all ‘corporate’ or ‘academic’ sounding words. If a sentence feels too perfect, break it up or make it more conversational. ...

February 12, 2026 ·  (Updated: February 19, 2026) · 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

SQL Index

Index (definition) Data structure / database object to speed up data retrieval. Stores a sorted copy of one or more columns plus pointers to data rows. Speeds up SELECT queries. Slows down INSERT, UPDATE, DELETE because indexes must be updated. Why indexes help performance Reduce full table scans by quickly locating rows. Make queries with WHERE, JOIN, ORDER BY, GROUP BY faster when they use indexed columns. Types of Indexes [1] Clustered index ...

February 6, 2026 ·  (Updated: February 18, 2026) · 4 min · 788 words · FewSteps
Read More

Behavioural Questions

1️⃣ “Tell us about a time you disagreed with a supervisor.” Situation: On a previous project, my supervisor wanted to release a feature quickly without full regression testing. Task: My responsibility was to ensure the release would not introduce production defects. Action: I respectfully shared my concerns, backed them with data from past incidents, and proposed a compromise—running a focused regression on high-risk modules instead of full testing. Result: We delayed the release by one day, avoided a potential production issue, and the supervisor later appreciated the risk-based approach. 👉 Key signal: Professional disagreement + data + teamwork 2️⃣ “Describe a time you had to solve a problem you didn’t immediately know the answer to.” Situation: During integration testing, an API intermittently failed with inconsistent error messages. Task: I needed to identify the root cause and ensure system stability before deployment. Action: I reviewed logs, reproduced the issue in a lower environment, collaborated with developers, and researched similar issues. I isolated the problem to a timeout configuration mismatch. Result: After fixing the configuration, the failures stopped, and the system passed integration testing. 👉 Key signal: Problem-solving + learning mindset 3️⃣ “How do you handle multi-tasking and competing priorities?” Situation: In one role, I was supporting testing, handling production issues, and assisting developers simultaneously. Task: I had to make sure critical issues were addressed without missing deadlines. Action: I prioritized tasks based on business impact, used a task-tracking system, communicated timelines clearly, and focused on high-risk items first. Result: All critical issues were resolved on time, and stakeholders were satisfied with the transparency and delivery. 👉 Key signal: Organization + calm under pressure 4️⃣ “Why do you want to work for the Commonwealth / PSP?” (This is motivation + values, not strict STAR—but structured works) ...

January 29, 2026 ·  (Updated: February 18, 2026) · 4 min · 736 words · FewSteps
Read More

Behavioural Questions

1. How are you? “I’m great, thank you. How are you?” 2. Why do you want to work here? “I’ve outgrown my current role and I’m looking for a new challenge. Based on what I’ve seen about this team’s goals, I know I can help you solve [specific problem this team is facing].” 3. Where do you see yourself in 5 years? “I see myself here, becoming an expert in this area and a valuable part of this team. This role aligns with where I want to go because [connect directly to the responsibilities of this role].” ...

January 29, 2026 ·  (Updated: February 16, 2026) · 3 min · 491 words · FewSteps
Read More

Create the Login page for hugo website testing

You want a fake login page inside your Hugo site (Papermod theme) so that you can teach QA automation with Java + Selenium using selectors like ID, name, CSS, XPath, etc. The login page should work like this: Page name: test.md Contains a form: username, password, Login button Valid credentials: username: fewsteps password: password If correct → redirect to login-success page If wrong → show an error message on the same page ...

January 29, 2026 ·  (Updated: February 16, 2026) · 4 min · 758 words · FewSteps
Read More

HR Database Administrator

Got it — below is your document cleaned up, with all links removed, consistent formatting, and properly numbered and titled for future revision as a Database Administrator prep guide. Database Administrator – Interview Preparation & Revision Guide Section 1 1. Tell Me About Yourself (Easy Version) Here’s a version that matches your background and sounds natural: “I have been working in IT for several years, mainly as an IT Analyst. I’ve supported applications and users, and over time I started working more with databases like SQL Server and Oracle. I have created tables, written queries, and helped improve performance and solve issues when applications were slow. I enjoy this kind of work and want to move into a dedicated database administrator role, especially in a stable public-service environment like the Department of Corrections.” ...

January 29, 2026 ·  (Updated: February 15, 2026) · 7 min · 1338 words · FewSteps
Read More