Practice free →
HomeSoftware TestingSoftware Testingtools_automation_cicd › Which is a best practice for stable Selenium scr…

Which is a best practice for stable Selenium scripts?

AAvoid running tests in headless browsers
BUse explicit waits for specific conditions
CUse Thread.sleep generously between actions
DHardcode all element locators in tests
Answer & Solution
Correct answer: B. Use explicit waits for specific conditions
Explicit waits (until condition) are robust against timing variance. Thread.sleep is brittle (too short fails; too long wastes time). Hardcoded locators hurt maintainability. Headless mode is actually preferred for CI.
Solve this in the app — Software Testing practice & 24k+ MCQs →
Related questions