Careeroza
Scenario Questions
A test passes locally but fails on Jenkins. How do you debug it?
- Read the report: error message, screenshot, URL and page source at failure.
- Run locally with the same settings:
-Dheadless=true, same browser version, same window size (headless default is 800×600). - Check environment differences: URL, test data, time zone, slower agent (timing / waits), proxy or VPN.
- Check parallel issues: shared static driver or shared test data.
- Add logs around the step and rerun the job; fix the root cause instead of adding sleeps.
Your regression suite takes 4 hours. How do you reduce it?
- Run in parallel (TestNG threads + Grid / Docker / cloud): often 5–10× faster.
- Create test data and log in through the API instead of the UI.
- Move pure logic checks (calculations, validations) to API or unit tests.
- Remove
Thread.sleepand long implicit waits; use explicit waits. - Split suites: smoke per build, full regression nightly; tag tests by priority.
How do you automate a page with OTP or CAPTCHA?
You do not break them; you ask for a testable setup in QA:
- CAPTCHA disabled or a fixed test key in QA/UAT (Google reCAPTCHA has test keys).
- Fixed OTP for test numbers (e.g. 123456) or an API/database hook to read the generated OTP.
- For email OTP, read it from a test mailbox API with retry and backoff.
Note: Saying "I would use OCR to read the CAPTCHA" is a red flag in interviews: CAPTCHA exists to stop automation.
A button click sometimes does nothing or throws ElementClickInterceptedException. What do you do?
Something covers the button (a spinner, a cookie banner, a sticky header) or it is not ready yet.
wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(".loading-spinner")));
WebElement btn = wait.until(ExpectedConditions.elementToBeClickable(By.id("checkout")));
((JavascriptExecutor) driver).executeScript("arguments[0].scrollIntoView({block:'center'});", btn);
btn.click();Close the banner in setup if it always appears. Use a JavaScript click only if the overlay is a test-environment artefact, and say why in a comment.