Planning to apply for a senior QA automation role in Singapore?
Whether you’re targeting positions at Grab, Shopee, DBS Bank, OCBC, UOB, Sea Group, or even government tech teams like GovTech, Selenium interview rounds here often go beyond basic WebDriver commands.
With 5 years of experience, hiring managers expect you to demonstrate hands-on expertise in Selenium framework design, CI/CD integration, and handling large-scale automation testing projects.
Roles like Senior QA Engineer, Test Automation Lead, or SDET in Singapore typically involve solving real-time test automation challenges, optimising Selenium test execution for Agile releases, and integrating tests into pipelines managed via Jenkins or GitLab CI/CD.
Questions will cover topics like cross-browser automation, Selenium Grid setup, flaky test handling, and dynamic element identification strategies.
This article compiles the most commonly asked selenium interview questions for 5 years experience candidates applying for QA and automation testing roles in Singapore. From Selenium WebDriver and framework architecture to CI/CD execution and real-world debugging scenarios, these 50 questions are designed to help you prepare thoroughly.
Framework Design and Architecture
1. Explain the Selenium Automation Framework you have built from scratch.
- Framework Type: Hybrid (Data + Keyword + POM)
- Language: Java (with Maven), occasionally Python for specific projects
- Test Runner: TestNG for Java projects, PyTest for Python
- Reporting: Extent Reports and Allure Reports for detailed HTML reports
- Build Tool: Maven or Gradle for dependency management
- CI/CD: Integrated with Jenkins for scheduled and triggered test runs
- Logging: Log4j for Java and Python logging module
- Parallel Execution: Implemented via TestNG XML and Selenium Grid
2. What are key components of a Selenium Hybrid Framework?
- Test Data Layer: Excel, JSON, or database sources
- Test Scripts: Modular test cases calling business functions
- Page Objects: Centralised element locators and methods per page
- Utilities: Custom libraries for waits, logs, screenshots
- Reporting: Automated report generation after test execution
- CI/CD Integration: Trigger points for Jenkins pipelines
- Exception Handling: Global error management for failed steps
3. How do you implement Page Object Model (POM) with Java/Python?
public class LoginPage
public void login(String user, String pass)
}
For Python, a similar class structure using Selenium’s WebDriver is followed.
4. Describe your folder structure and utility class design.
- src/main/java (or /python): Page Objects, Business Libraries
- src/test/java: Test scripts and runners
- Resources: Config files, test data files (Excel/JSON)
- Utils: Custom utilities for waits, screenshots, DB connections, reporting
- Logs: Runtime logs
- Reports: Auto-generated after execution
- Drivers: WebDriver binaries
5. How do you handle reusable components across tests?
- Launching browsers
- Logging in
- Reading test data
- Screenshot capture
- Common waits (Explicit, Fluent)
6. What logging strategy have you used in your frameworks?
- INFO: Test steps
- DEBUG: For debugging failures
- ERROR: For capturing exceptions
- WARN: For flaky behavior or retry logic
7. Explain your reporting setup (Extent, Allure, etc.).
- Extent Reports: For rich HTML reports with screenshots, step logs, and test status.
- Allure Reports: Used for CI environments with advanced categorisation and defect tracking.
- TestNG HTML Reports: As a lightweight backup option.
8. How do you enable parallel test execution in your framework?
- TestNG Level: By setting
parallel="tests"
orparallel="methods"
in TestNG XML. - Grid Level: Using Selenium Grid or Dockerized Selenium Grid setup for cross-machine parallelism.
9. How do you integrate external data sources (Excel, DB)?
10. Explain your test execution flow from trigger to report generation.
- Trigger from Jenkins or command line (using Maven goals like
clean test
) - Tests run using TestNG/PyTest with desired suite (Smoke/Regression)
- WebDriver and browser setup initialised via configuration files
- Test data loaded from external sources
- Page methods and utility functions invoked as per test flow
- On test pass/fail, reports updated and screenshots captured for failures
- Post-execution: Reports archived, logs saved, and email/Slack notifications triggered
Synchronisation and Wait Strategies
11. What is the difference between Implicit Wait, Explicit Wait, and Fluent Wait in Selenium?
- Implicit Wait: Applies a default wait time for every element search. Not specific to any element. Not recommended for complex scenarios.
- Explicit Wait: Targets specific elements with custom wait conditions like visibility, clickability, etc. Allows better control for dynamic elements.
- Fluent Wait: Extends Explicit Wait by adding polling frequency and exception ignoring. Best for elements that load intermittently or have unstable behavior.
Wait<WebDriver> wait = new FluentWait<>(driver)
.withTimeout(Duration.ofSeconds(30))
.pollingEvery(Duration.ofSeconds(5))
.ignoring(NoSuchElementException.class);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("username")));
Pro Tip: At 5 years experience, you should prefer Explicit or Fluent Wait for better stability.
12. How do you handle flaky tests caused by synchronisation issues?
- Always use Explicit Waits instead of Thread.sleep()
- Implement custom wait wrappers for recurring elements
- Utilise polling with Fluent Wait for elements with unpredictable load times
- Use
ExpectedConditions
for clickability and visibility checks - Monitor failed tests and adjust locator strategies for dynamic elements
- Configure retry logic for known flaky scenarios (using RetryAnalyzer in TestNG)
13. When would you use JavaScriptExecutor to resolve synchronisation problems?
- Standard Selenium click or sendKeys fails due to frontend JS issues
- Elements are hidden behind overlays or modals
- Page has heavy AJAX loading, causing element state inconsistencies
JavascriptExecutor js = (JavascriptExecutor) driver;
js.executeScript("arguments[0].click();", element);
Pro Tip: Use JSExecutor only as a fallback. It bypasses WebDriver’s event flow and can mask actual UI issues.
14. How do you handle page load timeouts in Selenium?
setPageLoadTimeout()
method to avoid indefinite waits for slow-loading pages.
Example (Java):
driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30));
Best Practices:
- Set timeouts based on application SLAs
- Log timeout exceptions for root cause analysis
- Combine with network stubbing tools during testing if possible
15. How do you handle AJAX-based elements that load dynamically after user actions?
- I use Explicit Wait with
ExpectedConditions.presenceOfElementLocated()
orvisibilityOfElementLocated()
- In case of loading spinners, I wait until spinner becomes invisible before interacting with elements
- For highly dynamic AJAX content, I sometimes use Fluent Wait with polling
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(20));
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.id("loader")));
Pro Tip: Always isolate AJAX-handling logic into reusable wait utility functions.
Data-Driven and Keyword-Driven Testing
16. How do you implement Data-Driven Testing in Selenium using TestNG?
@DataProvider
annotation. This allows running the same test with multiple input data sets.
Implementation Steps:
- Create a DataProvider method returning Object[][] from Excel, CSV, or JSON
- Link the DataProvider to your test method using
@Test(dataProvider = "name")
- Use Apache POI to fetch data dynamically from Excel files
@DataProvider(name = "loginData")
public Object[][] getData() ,
};
}
Pro Tip: For large datasets, I externalise DataProviders into separate utility classes.
17. How do you read test data from Excel in Selenium?
FileInputStream fis = new FileInputStream("TestData.xlsx");
Workbook wb = new XSSFWorkbook(fis);
Sheet sheet = wb.getSheet("LoginData");
String username = sheet.getRow(1).getCell(0).getStringCellValue();
Best Practices:
- Externalise file path and sheet name in config files
- Use data utility methods for cleaner test scripts
- Implement null/empty cell handling to prevent runtime failures
18. What is a Keyword-Driven Framework in Selenium and when should you use it?
- Test Data Source: Excel sheet mapping keywords to actions
- Driver Script: Reads keywords and executes corresponding Selenium functions
- Keyword Library: Reusable methods for each supported action
- When business teams want to define test flows without coding
- For projects with repetitive business flows
- When non-technical stakeholders contribute to test case design
19. How do you manage configuration data (URLs, credentials) in Selenium frameworks?
- Properties Files: For Java-based frameworks
- config.yaml or .ini Files: For Python frameworks
- Environment Variables: For CI/CD builds to handle sensitive data like credentials
- JSON/Excel: For storing environment-specific URLs, timeouts, and browser types
Properties prop = new Properties();
FileInputStream fis = new FileInputStream("config.properties");
prop.load(fis);
String url = prop.getProperty("baseUrl");
Pro Tip: Implement a Configuration Manager class to centralise all config file accesses.
20. How do you achieve test parameterisation in Selenium?
- TestNG Parameters: Using
@Parameters
annotation with TestNG XML - DataProvider: For multiple data rows
- Jenkins Job Parameters: For environment-specific execution in CI/CD
- Command Line Arguments: Using Maven command line options (e.g.,
-Dbrowser=chrome
)
<parameter name="browser" value="chrome"/>
SEO Tip: Proper parameterisation improves test flexibility and environment portability.
Cross-Browser and Parallel Execution
21. How do you set up cross-browser execution in Selenium?
- Define browser type in TestNG XML, Maven profile, or Jenkins build parameter
- Use conditional logic inside browser factory classes to launch Chrome, Firefox, or Edge
- Use WebDriverManager to manage browser driver binaries automatically
if (browser.equalsIgnoreCase("chrome")) else if (browser.equalsIgnoreCase("firefox"))
SEO Tip: Cross-browser execution ensures your Selenium scripts work across multiple environments.
22. What’s your approach to browser compatibility testing?
- Identifying target browsers based on business requirements (Chrome, Firefox, Edge, Safari)
- Maintaining a browser compatibility matrix documenting supported versions
- Running smoke and regression tests across all supported browsers before major releases
- Using Selenium Grid or cloud platforms like BrowserStack for scalable testing across multiple OS-browser combinations
23. How do you configure TestNG for parallel test execution?
parallel
attribute in the XML suite file.
Example TestNG XML:
<suite name="ParallelTests" parallel="methods" thread-count="5">
<test name="CrossBrowserTest">
...
</test>
</suite>
Key Considerations:
- Use ThreadLocal WebDriver instances to avoid session conflicts
- Ensure test data isolation for parallel-safe execution
- Configure timeouts carefully to avoid thread blocking
24. How do you set up Selenium Grid with Docker for distributed execution?
- Use official Selenium Docker images (Hub and Node images)
- Write a
docker-compose.yml
file to orchestrate Hub and Nodes - Expose necessary ports for communication
- Run the Grid locally or deploy on cloud infrastructure
- Scalability with minimal infrastructure setup
- Quick teardown and redeployment
- Consistent execution environment
25. How do you execute Selenium tests on cloud platforms like BrowserStack or Sauce Labs?
- Sign up and generate access credentials (Username and Access Key)
- Modify Selenium RemoteWebDriver configurations to point to the cloud grid URL
- Configure desired capabilities like OS, browser version, and resolution
- Integrate cloud dashboard URLs into Selenium test reports for traceability
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability("browserName", "chrome");
caps.setCapability("browserVersion", "latest");
driver = new RemoteWebDriver(new URL("https://hub.browserstack.com/wd/hub"), caps);
Pro Tip: Running on cloud significantly improves test coverage across devices and browsers without local infrastructure limitations.
CI/CD and Test Automation Pipeline
26. How do you integrate Selenium tests with Jenkins for CI/CD automation?
- Check out source code from Git during Jenkins build
- Invoke Maven commands like
clean test
for Java projects or use shell scripts for Python-based projects - Configure Jenkins to archive TestNG or JUnit XML reports after execution
- Integrate email or Slack notifications for build status
- Trigger jobs on specific Git branches or based on pull requests
27. What build tools have you used for Selenium test execution?
- Manage dependencies via
pom.xml
- Define test execution goals like
clean test
- Configure Surefire plugin for parallel execution and reporting
- Integrate Maven with Jenkins jobs for automated triggers
- Use
requirements.txt
for dependency management - Run PyTest commands with XML report generation for Jenkins compatibility
28. How do you publish Selenium test results in Jenkins?
- JUnit Plugin: For parsing TestNG or JUnit XML result files
- HTML Publisher Plugin: For publishing Extent Reports or Allure Reports as clickable build artifacts
- Post-Build Actions: For emailing report links to stakeholders
- Build Status Indicators: Using color-coded build status on Jenkins dashboards based on pass/fail ratios
29. How do you trigger Selenium test execution automatically after every code commit?
- Set Jenkins to listen for Git repository changes
- Trigger jobs on push events or pull requests
- Configure branch filters to run tests only on specific branches (e.g., develop, release)
- Integrate code quality gates (SonarQube) to run pre-test checks before Selenium execution
30. How do you handle environment-specific test execution in CI pipelines?
- Jenkins Build Parameters: Predefined environment selectors (e.g., QA, UAT, Production)
- System Properties (Java): Passed using Maven command line (e.g.,
-Denv=QA
) - Environment Variables: For sensitive info like DB passwords or tokens
- Config Files: Use separate config files per environment and load them dynamically in Selenium code
mvn clean test -Denv=UAT
SEO Tip: Environment parameterisation in Selenium helps support multi-environment deployments in CI/CD.
Advanced Selenium Scenarios
31. How do you manage session handling and cookies in Selenium?
- Preserving login sessions across tests
- Manipulating cookies for testing personalization or geo-targeting
- Clearing cookies between tests for environment isolation
Cookie ck = new Cookie("userToken", "xyz123");
driver.manage().addCookie(ck);
driver.manage().deleteAllCookies();
SEO Tip: Session and cookie management are essential for authentication testing in Selenium.
32. How do you handle multiple windows and browser tabs in Selenium?
getWindowHandles()
and switchTo().window()
to handle multiple windows or tabs.
Steps:
- Store the main window handle
- Trigger the new tab or window
- Switch WebDriver context using the window handle iterator
- Perform actions, then switch back
String parent = driver.getWindowHandle();
Set<String> allWindows = driver.getWindowHandles();
for (String window : allWindows)
}
Pro Tip: Always close child windows to avoid memory leaks in Selenium sessions.
33. How do you perform file upload and download automation with Selenium?
sendKeys()
on input elements of type “file”.
File Upload Example:
driver.findElement(By.id("uploadBtn")).sendKeys("C:\\path\\to\\file.pdf");
For file downloads:
- I configure browser profiles (like ChromeOptions) to set default download directories
- Use headless browser modes for CI environments
- For validating downloaded files, I check file presence and content in the download folder
34. How do you capture screenshots on test failure?
TakesScreenshot
interface.
Java Example:
File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(src, new File("Screenshots/failure.png"));
Best Practices:
- Capture screenshots on every test failure using TestNG Listeners or PyTest hooks
- Integrate screenshot links into Extent or Allure reports for traceability
- For parallel runs, add unique timestamp or thread ID to filenames
35. How do you handle alerts, pop-ups, and modal dialogs in Selenium?
- Switch control to the alert using
switchTo().alert()
- Use
accept()
,dismiss()
, orgetText()
based on test requirement - For modal dialogs (HTML-based), locate and interact with DOM elements
Alert alert = driver.switchTo().alert();
alert.accept();
SEO Tip: Handling pop-ups and modals is essential for Selenium UI automation interview rounds.
36. How do you handle Shadow DOM elements in Selenium?
JavascriptExecutor js = (JavascriptExecutor) driver;
WebElement shadowHost = driver.findElement(By.cssSelector("#shadowHost"));
WebElement shadowRoot = (WebElement) js.executeScript("return arguments[0].shadowRoot", shadowHost);
Approach:
- Access shadowRoot using JSExecutor
- Then locate child elements within the Shadow DOM
37. How do you write dynamic XPath locators for unstable elements?
contains()
for partial attribute matchesstarts-with()
for attribute prefixestext()
for text-based element selection- Parent/child/sibling axes for navigating DOM structure
//button[contains(text(),'Submit')]
SEO Tip: Mastery of dynamic XPath creation is critical for Selenium automation engineers handling frequently changing UIs.
38. How do you manage stale element exceptions in Selenium?
StaleElementReferenceException
using:
- Refetching the WebElement before interaction
- Using Explicit Wait to ensure element state is stable
- Encapsulating element actions inside retry blocks
- Waiting for page refresh or DOM reload completion
try catch (StaleElementReferenceException e)
Pro Tip: Proper wait strategies reduce stale element issues in dynamic web apps.
39. What is PageFactory in Selenium and how does it improve performance?
- Uses annotations like
@FindBy
- Loads elements only when called
- Supports page object encapsulation
PageFactory.initElements(driver, LoginPage.class);
SEO Tip: PageFactory usage is often asked in Selenium WebDriver interview rounds focused on framework optimization.
40. How do you optimise Selenium test suite performance for faster execution?
- Implement parallel test execution using TestNG or Selenium Grid
- Run only selected test groups for faster feedback
- Minimise use of Thread.sleep()
- Reuse browser sessions where appropriate
- Use headless browser modes for CI builds
- Implement retry logic for known flaky scenarios
- Optimise XPath and CSS locators for speed
Real-Time Project Scenarios
41. Describe a challenging automation bug you faced in a Selenium project and how you resolved it.
- I replaced static XPath locators with dynamic XPath using
contains()
andstarts-with()
functions. - Introduced Explicit Waits to ensure element presence.
- Created a custom locator utility class to standardise dynamic locator creation across the framework.
42. How did you reduce test execution time in your Selenium project?
- I enabled parallel test execution at the method and class level using TestNG
- Reduced page object initialization overhead by introducing lazy loading
- Replaced hard waits with optimized Explicit and Fluent Waits
- Switched from HTML reports to lightweight JSON reporting for faster I/O
- Ran sanity and smoke suites on every build, while keeping full regression for nightly runs
43. How do you differentiate between regression testing and smoke testing in Selenium automation?
- Comprehensive suite covering all core functionalities
- Executed before major releases
- Focus on checking for code regressions across modules
- Lightweight suite covering critical paths (e.g., login, checkout)
- Executed on every build to validate basic system stability
- Acts as a deployment gate for further testing
- I categorize tests into groups (@Test(groups = ))
- Maintain separate TestNG XMLs for smoke and regression runs
44. How do you handle flaky test cases in Selenium?
- Implemented retry logic using TestNG
RetryAnalyzer
- Introduced stabilised wait strategies (avoiding Thread.sleep())
- Set up test failure categorisation (Infrastructure issue vs Code defect)
- Logged flaky tests separately for monitoring and analysis
- Reviewed and refactored unreliable locators and test logic
45. Can you share a real scenario where Selenium automation caught a critical defect before release?
- Our cross-browser automation suite flagged the Chrome-specific failure
- The issue was traced to a JavaScript browser compatibility bug
- We raised a P1 defect, preventing a production release delay and potential revenue loss
- After the fix, the Selenium suite validated the patch across all browsers before deployment
Coding and Practical Selenium Tasks
46. Write a Selenium code snippet to handle dropdowns dynamically.
Select
class for standard dropdowns.
Java Example for Dynamic Dropdown Selection:
WebElement dropdown = driver.findElement(By.id("country"));
Select select = new Select(dropdown);
select.selectByVisibleText("India");
For Non-Select (Custom) Dropdowns:
- Click the dropdown element
- Use XPath or CSS selectors to locate and click the desired option
47. Write a program to capture dynamic tables using Selenium.
List<WebElement> rows = driver.findElements(By.xpath("//table[@id='dataTable']/tbody/tr"));
List<WebElement> cols = driver.findElements(By.xpath("//table[@id='dataTable']/tbody/tr[1]/td"));
for (int i = 1; i <= rows.size(); i++)
}
Pro Tip: Always check table row/column locators when table structures are dynamic.
48. Automate login with multiple credentials using DataProvider in TestNG.
@DataProvider
feature for data-driven login tests.
Sample DataProvider:
@DataProvider(name = "loginData")
public Object[][] getData() ,
};
}
Test Method:
@Test(dataProvider = "loginData")
public void loginTest(String username, String password)
SEO Tip: DataProvider-based login automation is a staple Selenium interview coding task.
49. Write a Selenium script to capture full-page screenshots.
Screenshot screenshot = new AShot().shootingStrategy(ShootingStrategies.viewportPasting(1000)).takeScreenshot(driver);
ImageIO.write(screenshot.getImage(), "PNG", new File("fullpage.png"));
Approach 2 – Chrome DevTools Protocol (For Chrome):
- Use ChromeOptions and DevTools API for full-page screenshots
50. Automate a Selenium script to detect broken links on a webpage.
List<WebElement> links = driver.findElements(By.tagName("a"));
for (WebElement link : links)
} catch (Exception e)
}
Pro Tip: Broken link validation using Selenium is useful for website maintenance automation scenarios.
Pro Tips for Cracking Selenium Automation Interviews
Answering Selenium interview questions for 5 years experience roles requires more than textbook knowledge. Here are a few preparation strategies:
- Know Your Projects: Be ready to explain real-world Selenium projects you’ve worked on. Focus on frameworks, challenges, and business impact.
- Practice Coding: Expect live coding rounds. Brush up on Selenium WebDriver commands, locators, waits, and exception handling.
- Understand Framework Design: Interviewers often ask about Selenium framework architecture, especially for senior QA roles.
- Prepare for Debugging Scenarios: You might be shown a failing Selenium script and asked to fix or debug it in real-time.
- CI/CD Integration Knowledge: Be familiar with Jenkins, Maven, Docker, and how Selenium fits into CI/CD pipelines.
- Highlight Soft Skills: Communication, stakeholder management, and defect reporting are as important as technical answers.
Strong interview preparation on these aspects can set you apart from other candidates applying for Selenium automation testing roles.