Introduction
Forms are one of the most commonly automated components in Selenium projects.
Whether you're automating a login page, registration form, payment screen, profile page, or checkout flow, you'll interact with text boxes, buttons, radio buttons, and checkboxes almost every day.
Although these controls appear simple, they often contain business rules that must be validated carefully. A field may accept only numbers, trim extra spaces, reject invalid characters, or become enabled only after another action. Similarly, buttons may remain disabled until mandatory fields are completed, while checkboxes and radio buttons may control the visibility or behavior of other UI elements.
For this reason, interviewers frequently ask practical questions about form controls and expect candidates to understand not only how to automate them but also how to validate their behavior under different conditions.
This practice guide helps you build those skills through progressive hands-on exercises that simulate real application behavior.
Text Box – Input Validation Practice
Text boxes appear in almost every web application. Beyond simply entering text, automation engineers must verify that each field behaves correctly according to business requirements.
This section focuses on validating user input under both normal and edge-case conditions.
Basic Input Validation Exercises
Practice the following scenarios on login forms, registration pages, or profile screens.
Exercise 1
Enter valid input into a username field.
Expected Result:
- The application accepts the value.
- No validation message appears.
Exercise 2
Enter invalid input.
Examples include:
- Incorrect username
- Invalid email format
- Unsupported characters
Verify the appropriate validation message is displayed.
Exercise 3
Leave the textbox empty and submit the form.
Validate:
- Required field message appears.
- Submission is blocked.
Exercise 4
Enter numbers into a text-only field.
Examples:
- Name
- City
- Country
Verify whether the application rejects the input.
Exercise 5
Enter alphabets into a numeric field.
Examples:
- Phone Number
- ZIP Code
- Employee ID
Validate that invalid characters are rejected.
Exercise 6
Enter special characters.
Examples:
@#$%^&*
Observe whether the field:
- accepts,
- rejects,
- or sanitizes the input.
Exercise 7
Enter the maximum allowed number of characters.
Verify:
- Input is accepted.
- No truncation occurs.
Exercise 8
Enter more than the maximum allowed length.
Validate:
- Additional characters cannot be entered, or
- Proper validation appears.
Exercise 9
Enter the minimum required number of characters.
Verify successful validation.
Exercise 10
Enter leading and trailing spaces.
Examples:
Naveed
Naveed
Naveed
Validate whether spaces are automatically trimmed after submission.
Security Validation Exercises
Real-world applications should protect against malicious user input.
Practice the following security-focused scenarios.
Exercise 11
Enter a SQL Injection string.
Example:
' OR 1=1 --
Observe:
- Error handling
- Validation
- Sanitization
Exercise 12
Enter JavaScript code.
Example:
<script>alert("Test")</script>
Verify the application safely handles the input.
Exercise 13
Copy and paste text instead of typing.
Validate:
- Input is accepted.
- Validation still works correctly.
Exercise 14
Correct invalid input.
Verify:
- Previous validation messages disappear automatically.
Exercise 15
Submit without focusing the textbox.
Some applications trigger validation only after focus changes.
Observe the application's behavior.
Exercise 16
Enter Unicode characters.
Examples:
नमस्ते
こんにちは
مرحبا
Validate proper display and storage.
Exercise 17
Enter emoji characters.
Examples:
😊 🚀 🎉
Verify application support.
Exercise 18
Enter an extremely long string.
Purpose:
- Performance testing
- Input handling
- UI responsiveness
Exercise 19
Refresh the page.
Verify:
- Entered values reset correctly.
Exercise 20
Reload the page.
Observe whether previously entered values persist.
Learning Objectives
After completing these exercises, you should understand:
- Required field validation
- Character restrictions
- Boundary testing
- Security validation
- Performance considerations
- Unicode handling
- Browser behavior during refresh
Disabled and Read-Only Text Box Practice
Enterprise applications frequently contain fields that users can view but cannot edit.
Examples include:
- Employee ID
- Customer Number
- Generated Order Number
- System-created Username
Automation engineers must verify that these fields behave correctly.
Exercise 1
Locate a disabled textbox.
Verify:
- The field cannot receive input.
Exercise 2
Attempt to enter text into the disabled field.
Observe Selenium's behavior.
Record the exception (if any).
Exercise 3
Validate the displayed value.
Although the field is disabled, users should still be able to read its contents.
Retrieve the value using the appropriate WebElement method.
Exercise 4
Locate a read-only textbox.
Verify:
- Text can be selected.
- Text cannot be modified.
Exercise 5
Attempt to clear the read-only field.
Observe the behavior.
Exercise 6
Enable a field dynamically.
Some applications unlock fields after:
- clicking Edit,
- selecting a checkbox,
- changing user permissions.
Once enabled:
- Enter new text.
- Save changes.
Exercise 7
Validate dynamic enablement.
Example:
Selecting "Company Employee"
↓
Employee ID field becomes editable.
Verify this workflow.
Exercise 8
Submit the form.
Verify:
- Disabled field values remain unchanged.
- Read-only values remain unchanged.
Exercise 9
Navigate through the form using the Tab key.
Verify:
- Disabled fields are skipped.
- Focus moves to the next editable control.
Exercise 10
Inspect HTML attributes.
Validate:
- disabled
- readonly
- aria-disabled
Understand how each affects Selenium interactions.
Exercise 11
Compare behavior across browsers.
Repeat the same validation in:
- Chrome
- Firefox
- Edge
Observe differences.
Exercise 12
Switch between View Mode and Edit Mode.
Validate:
- Read-only state
- Editable state
- Save behavior
Exercise 13
Verify backend validation.
Attempt to manipulate a disabled field using browser developer tools.
Submit the form.
Verify the backend ignores unauthorized changes.
Exercise 14
Validate tooltip behavior.
Some disabled fields display explanatory tooltips.
Verify:
- Tooltip appears.
- Message is correct.
Exercise 15
Accessibility Validation.
Verify screen readers correctly identify:
- disabled fields
- read-only fields
Learning Objectives
These exercises help you understand:
- Difference between disabled and read-only controls
- Dynamic field enablement
- Browser behavior
- Accessibility considerations
- Security validation
Placeholder Validation Practice
Placeholders improve usability by showing users what information should be entered.
Although they appear simple, placeholders are often included in UI validation test cases.
Exercise 1
Verify placeholder text is displayed.
Examples:
Enter Username
Email Address
Exercise 2
Validate spelling.
Check for:
- Grammar
- Typographical errors
- Missing punctuation
Exercise 3
Type into the textbox.
Verify:
- Placeholder disappears immediately.
Exercise 4
Clear the textbox.
Verify:
- Placeholder reappears.
Exercise 5
Click inside the textbox.
Observe whether placeholder styling changes.
Exercise 6
Compare placeholder text with requirement documents.
Ensure:
- Exact wording
- Correct capitalization
- Required formatting
Exercise 7
Repeat validation across browsers.
Compare:
- Chrome
- Firefox
- Edge
Exercise 8
Refresh the page.
Verify placeholder remains visible.
Exercise 9
Validate placeholders on mandatory fields.
Ensure every required field includes meaningful guidance.
Exercise 10
Verify placeholders are not treated as actual values.
Submit the form without entering data.
Expected Result:
- Validation errors appear.
- Placeholder text is not submitted.
Exercise 11
Copy placeholder text.
Paste it into the field.
Submit the form.
Observe application behavior.
Exercise 12
Validate password placeholders.
Examples:
Enter Password
Minimum 8 Characters
Exercise 13
Accessibility Validation.
Verify screen readers correctly announce placeholder guidance.
Exercise 14
Disabled Field Placeholder
Verify whether placeholders remain visible in disabled controls.
Exercise 15
Responsive Validation
Repeat placeholder validation on:
- Desktop
- Tablet
- Mobile viewport
Observe alignment and visibility.
Buttons – State & Click Behavior
Buttons are much more than clickable elements. In enterprise applications, they often change state depending on user input, permissions, API responses, or business rules.
A good automation engineer validates not only that a button can be clicked, but also that it behaves correctly before, during, and after user interaction.
Basic Button Exercises
Exercise 1
Verify a button is enabled by default.
Expected Result:
- User can click immediately.
- No validation errors appear.
Exercise 2
Verify the button remains disabled until mandatory fields are completed.
Example:
- Username
- Password
↓
Login button becomes enabled.
Exercise 3
Click the button without entering any input.
Validate:
- Required field messages appear.
- Form submission is blocked.
Exercise 4
Verify clicking the button performs the correct action.
Examples:
- Login
- Register
- Search
- Save
Exercise 5
Click the same button multiple times quickly.
Validate:
- Duplicate requests are not generated.
- Only one action is processed.
Exercise 6
Verify double-click behavior.
Some applications:
- Ignore double clicks.
- Trigger a special action.
- Prevent duplicate submission.
Observe the application's implementation.
Exercise 7
Activate the button using the keyboard.
Practice using:
- Enter
- Spacebar
instead of the mouse.
Exercise 8
Navigate using the Tab key.
Verify:
- Focus reaches the button.
- Enter activates it correctly.
Exercise 9
Validate button text.
Examples:
- Login
- Submit
- Save
- Continue
Ensure wording matches requirements.
Exercise 10
Validate button icons.
Verify:
- Correct icon
- Proper alignment
- Correct spacing
Button UI Validation
Exercise 11
Verify button alignment.
Check consistency across:
- Desktop
- Tablet
- Mobile
Exercise 12
Validate button size.
Ensure:
- Width
- Height
- Responsive behavior
meet UI standards.
Exercise 13
Hover over the button.
Observe:
- Color changes
- Shadow effects
- Cursor changes
Exercise 14
Click the button.
Verify visual feedback:
- Ripple effect
- Loading animation
- Pressed state
Exercise 15
Validate accessibility labels.
Examples:
- aria-label
- aria-describedby
Dynamic Button Behavior
Exercise 16
Submit a form.
Verify:
- Button becomes disabled during processing.
Exercise 17
Trigger a long-running API request.
Validate:
- Loading indicator appears.
- Multiple clicks are prevented.
Exercise 18
Force the API request to fail.
Verify:
- Error message appears.
- Button becomes enabled again.
Exercise 19
Refresh the page.
Validate the button returns to its default state.
Exercise 20
Repeat all button validations across browsers.
Practice on:
- Chrome
- Firefox
- Edge
Combined Text Box + Button Scenarios
Real applications rarely contain isolated controls.
Instead, text boxes and buttons work together to complete business workflows.
Practice complete form validation rather than individual actions.
Exercise 1
Enter valid data.
Click Submit.
Verify:
- Successful submission.
- Success message.
- Navigation.
Exercise 2
Leave one mandatory field empty.
Verify:
- Button behavior.
- Validation messages.
Exercise 3
Correct the invalid input.
Ensure:
- Validation disappears.
- Button becomes enabled.
Exercise 4
Enter invalid data.
Click Submit.
Verify:
- Submission is blocked.
Exercise 5
Refresh the page.
Verify:
- Fields reset.
- Button returns to default state.
These complete scenarios closely resemble real project automation tasks.
Checkboxes & Radio Buttons
Checkboxes and radio buttons are frequently used to collect user preferences.
Examples include:
- Hobbies
- Skills
- Notifications
- Gender
- Subscription plans
- Payment methods
- Product filters
Although Selenium interactions are simple, the business rules surrounding these controls are often complex.
Level 1 – Beginner Exercises (0–1 Year)
Single Checkbox
Exercise 1
Select a checkbox.
Verify it becomes selected.
Exercise 2
Select only if it isn't already selected.
Avoid unnecessary clicks.
Exercise 3
Unselect a checkbox only if it is currently selected.
Exercise 4
Verify default checkbox selection.
Some applications load with:
- Accepted Terms
- Email Notifications
already selected.
Validate default behavior.
Exercise 5
Attempt to select a disabled checkbox.
Observe Selenium behavior.
Record the exception if applicable.
Radio Buttons
Exercise 6
Select one radio button.
Verify selection.
Exercise 7
Select another radio button.
Ensure:
- Previous selection is removed.
- Only one remains selected.
Exercise 8
Verify the default selected radio button.
Exercise 9
Click an already selected radio button.
Observe the application's response.
Exercise 10
Click the radio button label instead of the radio itself.
Verify selection changes correctly.
Exercise 11
Validate the selected option using Selenium state methods.
Level 2 – Intermediate Exercises (1–3 Years)
These exercises simulate real production forms.
Multiple Checkboxes
Exercise 1
Select multiple checkboxes.
Example:
- Reading
- Music
- Cricket
Exercise 2
Select checkboxes by visible text.
Exercise 3
Select checkboxes using their value attribute.
Exercise 4
Select every checkbox within a section.
Exercise 5
Deselect every checkbox.
Exercise 6
Randomly select several checkboxes.
Practice automation logic.
Exercise 7
Count the selected checkboxes.
Validate the expected total.
Exercise 8
Ensure at least one checkbox remains selected before submission.
Exercise 9
Validate mandatory checkbox selection.
Example:
"I Agree to Terms and Conditions"
↓
Submission should fail if unchecked.
Radio Button Exercises
Exercise 10
Select a radio button based on test data.
Example:
Gender:
Male
or
Female
Exercise 11
Change the selected option.
Verify:
- UI updates correctly.
- Business rules execute.
Exercise 12
Handle radio buttons inside tables.
Exercise 13
Handle radio buttons inside lists.
Dynamic Controls
Exercise 14
Select checkboxes generated dynamically.
Example:
Preferences loaded from an API.
Exercise 15
Wait for dynamically loaded checkboxes.
Select them after they appear.
Exercise 16
Refresh the page.
Verify selections persist (or reset according to business requirements).
Exercise 17
Attempt submission without selecting a mandatory checkbox.
Verify:
- Validation message.
- Submission blocked.
Level 3 – Advanced Exercises (3–5 Years)
These exercises simulate difficult automation scenarios commonly encountered in enterprise projects.
JavaScript Click
Exercise 1
Attempt a normal Selenium click.
If it fails,
perform a JavaScript click.
Compare the results.
Actions Class
Exercise 2
Use the Actions class to select a checkbox.
Useful when normal clicks fail.
Custom UI Controls
Exercise 3
Handle checkboxes built using:
- div
- span
- custom components
instead of standard HTML inputs.
Exercise 4
Handle custom-styled radio buttons.
Many React and Angular applications implement custom controls.
Practice locating and selecting them.
Attribute Validation
Exercise 5
Validate checkbox selection using HTML attributes.
Compare:
- checked
- aria-checked
Frames & Modals
Exercise 6
Select a checkbox inside an iframe.
Exercise 7
Handle radio buttons displayed inside modal dialogs.
Scrollable Sections
Exercise 8
Locate a checkbox inside a scrollable container.
Scroll until visible.
Select it.
Read-Only Controls
Exercise 9
Validate read-only checkbox behavior.
Ensure users cannot change state.
Explicit Wait
Exercise 10
Wait until the checkbox becomes clickable.
Then perform selection.
Parallel Execution
Exercise 11
Run checkbox tests in parallel.
Verify:
- No interference.
- Stable execution.
Thread Safety
Exercise 12
Ensure checkbox validation remains isolated across multiple threads.
This is an important framework-level exercise.
Real-Time Business Scenarios
Enterprise applications rarely ask users to simply click a checkbox or radio button. Instead, these controls are tied to business logic, permissions, and dynamic UI behavior. These exercises simulate those real-world workflows.
Scenario 1 – User Preference Page
Imagine a profile settings page where users choose their interests.
Example:
- Sports
- Music
- Movies
- Technology
- Travel
Practice
- Select one preference.
- Select multiple preferences.
- Save the profile.
- Reload the page.
- Verify the selections persist.
Scenario 2 – Insurance Plan Selection
An insurance application allows users to select only one plan.
Available plans:
- Basic
- Premium
- Family
- Enterprise
Validate
- Only one plan can be selected.
- Previous selection is automatically removed.
- Correct premium is displayed after selection.
Scenario 3 – E-Commerce Filters
Most shopping websites contain filter checkboxes.
Examples:
- Brand
- Size
- Price
- Rating
- Availability
Practice
Select filters.
Verify:
- Products refresh correctly.
- Filter count updates.
- Selected filters remain highlighted.
Scenario 4 – Registration Form
Create a registration automation flow.
Fields:
- Username
- Password
- Confirm Password
Checkbox:
"I agree to Terms & Conditions"
Validate
- Form cannot be submitted without accepting terms.
- Error message appears.
- Submission succeeds after checking the box.
Scenario 5 – Survey Form
Survey contains:
Radio Buttons
- Excellent
- Good
- Average
- Poor
Checkboxes
- Multiple interests
- Multiple feedback categories
Validate
- Only one rating is selected.
- Multiple interests can be selected.
- Submitted values are correct.
Scenario 6 – Application Settings
Application loads default settings.
Example:
✓ Email Notifications
✓ SMS Alerts
✗ Promotional Emails
Validate
- Default selections
- User changes
- Save
- Refresh
- Persistence
Scenario 7 – Backend-Loaded Preferences
Preferences arrive through an API.
Automation should:
- Wait until controls appear.
- Select required values.
- Validate successful save.
Scenario 8 – Checkbox Controls Other Fields
Example:
☐ Company Account
↓
Company Name textbox becomes enabled.
Practice:
- Verify initial disabled state.
- Select checkbox.
- Validate textbox becomes editable.
- Uncheck.
- Verify textbox disables again.
Scenario 9 – Radio Reset
Submit a form.
Click Reset.
Validate:
- Default radio selection returns.
- Previous selection disappears.
Scenario 10 – Saved Preferences
Update user settings.
Logout.
Login again.
Verify all selected options are retained.
Level 5 – Failure & Edge-Case Scenarios
These are the kinds of problems automation engineers troubleshoot in production projects.
Scenario 1 – Checkbox Click Fails Randomly
Symptoms
- Sometimes works
- Sometimes fails
Investigate:
- Timing issues
- Overlay
- Loader
- Animation
- Stale element
Fix using:
- Explicit Wait
- Stable locator
- JavaScript click (only if necessary)
Scenario 2 – Element Is Visible But Not Clickable
Possible causes:
- Hidden overlay
- Loading spinner
- Animation
- Disabled state
Debug the problem.
Apply the appropriate solution.
Scenario 3 – Selected in UI but Not in DOM
Visual selection appears correct.
However,
Selenium reports:
isSelected() == false
Investigate custom UI implementations.
Validate using:
- CSS classes
- aria-checked
- JavaScript attributes
Scenario 4 – Duplicate Checkboxes
Multiple elements match the same locator.
Practice:
- Identify duplicates.
- Build dynamic locators.
- Select the correct checkbox.
Scenario 5 – Browser-Specific Failure
Checkbox works in Chrome.
Fails in Firefox.
Practice debugging:
- Different rendering
- Timing
- Browser compatibility
Scenario 6 – Custom Radio Components
Modern React applications often replace:
<input type="radio">
with
<div>
<span>
Practice locating these components.
Select using:
- Parent element
- Label
- JavaScript
- Actions class
Scenario 7 – Checkbox Disappears After Click
Application re-renders.
Original WebElement becomes stale.
Practice:
- Re-locate element
- Continue execution
- Avoid StaleElementReferenceException
Scenario 8 – State Lost After Refresh
Select preferences.
Validate:
- Correct persistence
- Or correct reset
depending on business requirements.
Scenario 9 – Wrong Checkbox Selected
Automation uses:
checkboxes.get(2)
Application changes order.
Wrong checkbox gets selected.
Fix by:
- Text
- Label
- Value
- Relative XPath
- CSS
Avoid index-based locators whenever possible.
Scenario 10 – Parallel Execution Issues
Run checkbox tests in parallel.
Verify:
- Independent browser sessions
- No shared WebDriver
- Stable state validation
Very Important Real-Time Interview Exercises
These exercises are frequently discussed in Selenium interviews.
Exercise 1
Select user preferences.
Save.
Verify database/UI updates correctly.
Exercise 2
Validate default selections.
Exercise 3
Select multiple hobbies.
Submit.
Verify submitted values.
Exercise 4
Select a subscription plan using radio buttons.
Validate billing updates.
Exercise 5
Ensure mandatory Terms & Conditions checkbox blocks submission.
Exercise 6
Verify only one radio button remains selected at all times.
Demo Website Mapping
The following practice websites closely match enterprise applications and provide excellent opportunities to strengthen Selenium skills.
DemoQA
Recommended for:
- Text boxes
- Forms
- Radio buttons
- Checkboxes
- Dynamic properties
- Modal dialogs
Exercises:
- Input validation
- Placeholder validation
- Radio selection
- Checkbox hierarchy
- Dynamic enable/disable
- Form submission
OrangeHRM Demo
Best for:
- Login validation
- Enterprise forms
- Dynamic UI
- Error messages
Practice:
- Username validation
- Password validation
- Disabled controls
- Business workflows
the-internet.herokuapp.com
Recommended for:
- Login scenarios
- Dynamic controls
- Dynamic loading
- Secure forms
Practice:
- Validation messages
- Checkbox appearance/disappearance
- Timing problems
- Explicit waits
Selenium Easy
Best for:
- Basic checkbox practice
- Radio buttons
- Input forms
Exercises:
- Single checkbox
- Multiple checkbox
- Success message validation
- Dynamic controls
Rahul Shetty Practice
Recommended for:
- Custom controls
- Scrollable elements
- Dynamic forms
Practice:
- Custom checkboxes
- JavaScript click
- Advanced Selenium handling
AutomationExercise
Useful for:
- Registration
- Login
- Input validation
- Security testing
Practice:
' OR 1=1
- Script Injection
<script>alert(1)</script>
- Boundary testing
- Special characters
Complete Interview Practice Checklist
Before attending Selenium interviews, ensure you can confidently demonstrate all of the following without referring to notes.
Text Boxes
✓ Validate required fields
✓ Max length
✓ Min length
✓ Placeholder
✓ Read-only
✓ Disabled
✓ Special characters
✓ Unicode
✓ XSS input
✓ Copy-paste
✓ Refresh behavior
Buttons
✓ Enabled
✓ Disabled
✓ Loading state
✓ Hover
✓ Multiple clicks
✓ Keyboard activation
✓ API loading
✓ Accessibility
Checkboxes
✓ Single selection
✓ Multiple selection
✓ Conditional selection
✓ Dynamic selection
✓ JavaScript click
✓ Custom UI
✓ Hidden elements
✓ Parallel execution
Radio Buttons
✓ Default selection
✓ Change selection
✓ Dynamic selection
✓ Label click
✓ Custom components
✓ Tables
✓ Lists
Dynamic Scenarios
✓ Loader handling
✓ Delayed controls
✓ Re-rendering
✓ Stale elements
✓ Browser differences
✓ Framework-safe implementation
Best Practices
While completing these exercises, follow these real-world automation practices:
- Use explicit waits instead of
Thread.sleep(). - Prefer stable locators such as ID, name, CSS selectors, or reliable XPath.
- Check an element's state before interacting with it.
- Avoid index-based locators when identifying checkboxes or radio buttons.
- Handle custom UI controls using appropriate strategies such as JavaScript or the Actions class only when standard interactions fail.
- Design reusable helper methods for common actions.
- Keep tests independent so they can run safely in parallel.
- Validate both the UI behavior and the underlying business rules.