Video summary
Session 49 - Selenium with Java | Hybrid Automation Framework | Page Object Model
Main summary
Key takeaways
Overview / Goal of the session
- The session starts the implementation phase of a Hybrid Automation Framework for Selenium + Java + TestNG using the Page Object Model (POM).
- Approach: design the full framework first, working incrementally:
- Start with 1–2 test cases
- Build the framework scaffolding (page objects, utilities, test base, properties/resources, etc.)
- After the framework is stable, add more test cases continuously
- Execution workflow described:
- Run TestNG (test-suite XML) to generate reports/logs
- Commit code to a local Git repository
- Push to GitHub (remote/global)
- Run in Jenkins in a remote environment (pipeline/CI concept)
Framework design / tech stack
- Framework type: Hybrid-driven framework
- Tech components mentioned:
- Java
- Selenium
- TestNG
- Page Object Model
- Project structure responsibilities:
- Page objects: only page classes + elements/actions per screen
- Test cases: test classes that call page object methods
testng.xml/ suite XML files: orchestrate running tests and generating reports/logs- Utilities / test data / resources: used by tests
- Reports / logs / screenshots / test data folders: placed at the project level
Maven setup and dependency configuration (Step 1)
- Emphasis is placed on creating a new Maven project in Eclipse for easier dependency management and reuse across environments.
- Dependencies to add to
pom.xml(examples mentioned):- Selenium Java
- Apache POI (Excel support)
- Log4j (logging)
- Apache Commons IO / Lang3
- TestNG
- Extent Report (reporting)
- Process guidance:
- Create Maven project → edit
pom.xml→ add dependencies → update Maven project
- Create Maven project → edit
Folder / package structure (scaffolding)
- Uses standard Maven layout but modifies it for the framework:
- Mainly uses:
src/test/javafor framework code (page objects, tests, utilities)src/test/resourcesfor resource files like properties/log config
- Removes unused Maven folders (as per instructor’s current approach)
- Mainly uses:
- Recommended packages under
src/test/java:pageObjects(POM classes)testCases(TestNG test classes)utilities(helper classes like Excel utilities, Extent report manager, etc.)- Later:
testBase(shared test setup/teardown + reusable methods)
- Project-level folders (created directly under project root):
logsreportsscreenshotstestData(Excel/data files later)
Resource vs package distinction (important)
src/test/resourcesis for resource files (e.g.,.properties, log4j config). Excel/text data should go into folders (e.g.,testData), not necessarily as Java packages.
- Packages contain Java classes, while folders can contain any file types.
Page Object Model implementation (for the first test case)
Target test case
- Account Registration is chosen as the first test because it leads to login credentials for subsequent tests.
Page object classes created
-
Homepage page object
- Contains elements:
My Account(link)Register(link)
- Action methods:
clickMyAccount()clickRegister()
- Contains elements:
-
Account Registration page object
- Contains form elements and actions:
- first name, last name, email, phone, password, confirm password
- privacy policy checkbox
- continue/submit button
- confirmation message element
- Action methods follow naming conventions (prefix hints):
txt*for text boxeschk*for checkboxesbtn*for buttons
- No validation inside page objects:
getConfirmationMessage()returns the displayed message as a String only- Actual assertion/validation is done in the TestNG test class
- Contains form elements and actions:
Reusability via Base Page (constructor inheritance)
- Introduce a
BasePageclass underpageObjects:- Contains only the constructor setup (driver field + PageFactory initialization).
- All page object classes extend BasePage to avoid rewriting constructors repeatedly.
Test class implementation (TestNG)
Structure for the test case class
- Create a new TestNG test class under
testCases:- Example naming:
TC001_AccountRegistrationTest
- Example naming:
- Includes methods:
@BeforeClass setup():- Initialize WebDriver (ChromeDriver mentioned)
- Delete cookies
- Navigate to application URL
- Maximize window
@AfterClass tearDown():- Quit/close driver
@Test verify_account_registration():- Instantiate
HomepageandAccountRegistrationPage - Use page object methods to:
- click My Account
- click Register
- fill registration form
- submit
- retrieve confirmation message
- Assertion using TestNG
Assert.assertEquals(...)
- Instantiate
Advantage shown
- A single test method can use multiple page object classes (Homepage + Registration page).
Handling test failures with dynamic input (random test data)
Problem demonstrated
- Running the same registration test twice fails because the same email is already registered.
Solution
- Create user-defined methods to generate dynamic values at runtime:
- Random alphabetic string (for email/local part, names)
- Random numeric string (phone numbers)
- Random alphanumeric with special characters (password)
- Uses Commons Lang3:
RandomStringUtils.randomAlphabetic(n)RandomStringUtils.randomNumeric(n)
- Case formatting for names:
- convert generated string to uppercase for first/last name via
.toUpperCase()
- convert generated string to uppercase for first/last name via
Password generation rule
- Generate password once, store in a variable, and reuse for:
- password
- confirm password
- This prevents mismatch failures.
Reusability via Test Base (extract duplicated test methods)
- After the test works, instructor refactors:
- Setup/teardown and random-data helper methods are moved into a
BaseClassunder thetestBasepackage.
- Setup/teardown and random-data helper methods are moved into a
- Resulting pattern:
- Each test class extends BaseClass
- Test class contains mostly only the
@Testmethod(s)
- Key objective: avoid duplication across test cases and centralize common logic.
Notes for next session / what’s deferred
- Logging and reporting additions are mentioned as next steps (not completed in this session).
- Excel/data-driven testing is explicitly deferred:
- Current work uses single test data (not Excel-driven).
- Excel will be used later for data-driven test cases.
Key speakers/sources (as stated by subtitles)
- No specific person’s name is spoken in the subtitles.
- Source indicated only by the video title:
- “Session 49 - Selenium with Java | Hybrid Automation Framework | Page Object Model”
Rate this summary
Your feedback will help improve summaries.
Improve this summary
Reprocess with a stronger model when the summary feels incomplete or inaccurate.
Translate summary in another language
Ask questions to this video
Chat for follow-up questions, clarifications, and source-backed answers.