{"id":136,"date":"2024-07-25T20:04:41","date_gmt":"2024-07-25T20:04:41","guid":{"rendered":"https:\/\/logicnextgen.com\/tutorials\/?page_id=136"},"modified":"2026-05-23T09:20:43","modified_gmt":"2026-05-23T09:20:43","slug":"automation-testing-interview-questions","status":"publish","type":"page","link":"https:\/\/logicnextgen.com\/tutorials\/automation-testing-interview-questions\/","title":{"rendered":"Selenium Interview Questions &amp; Answers"},"content":{"rendered":"\n<p class=\"has-text-color has-link-color has-large-font-size wp-elements-1 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>Top<\/strong> <strong>Selenium Interview Questions &amp; Answers<\/strong><\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-2 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>1. What are Locators in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Locators are used to identify web elements on a webpage so that Selenium can interact with them.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>id<\/li>\n\n\n\n<li>name<\/li>\n\n\n\n<li>className<\/li>\n\n\n\n<li>tagName<\/li>\n\n\n\n<li>linkText<\/li>\n\n\n\n<li>partialLinkText<\/li>\n\n\n\n<li>xpath<\/li>\n\n\n\n<li>cssSelector<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-3 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>2.<\/strong> <strong>What is XPath, and what are the types of <strong>XPath<\/strong>?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">XPath is a locator strategy used to navigate through XML\/HTML DOM structure.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Absolute XPath \u2192 starts from root (<code>\/html\/body\/...<\/code>) \u274c not recommended<\/li>\n\n\n\n<li>Relative XPath<strong> <\/strong>\u2192 flexible and stable (<code>\/\/input[@id='email']<\/code>) \u2705<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">XPath is useful for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Dynamic elements<\/li>\n\n\n\n<li>Complex structures<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-align-left has-text-color has-link-color has-medium-font-size wp-elements-4 wp-block-paragraph\" style=\"color:#ff8d00\">3. <strong>What is a page object model?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The Page Object Model (POM) is a design pattern used in test automation that helps you create clean, maintainable, and reusable test code \u2014 especially for web applications.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In POM, each web page of your application is represented by a separate class (a \u201cPage Object\u201d), and all the elements (buttons, fields, links, etc.) and actions (clicks, form submissions, etc.) on that page are defined as methods in that class.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Better Code Organization<br>Keeps UI locators and actions in one place.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reusability<br>You can use the same page object in multiple tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Easier Maintenance<br>If a page changes, you update only one file \u2014 not all your test scripts.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Improved Readability<br>Tests become more readable and behave like real-world actions.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-5 wp-block-paragraph\" style=\"color:#ff8d00\">4. <strong>What is the role of TestNG in Automation Testing?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:16px\">TestNG is a testing framework that helps organize, execute, and manage automated tests efficiently. It supports features like test grouping, prioritization, parallel execution, and data-driven testing.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\" style=\"font-size:16px\">It also generates detailed reports and integrates well with tools like Selenium and CI\/CD pipelines<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-6 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>5. What are Waits in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Waits are used to handle synchronization issues when elements take time to load. Without waits, Selenium may try to interact with elements before they are available, causing failures.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Implicit Wait \u2192 applies globally<\/li>\n\n\n\n<li>Explicit Wait \u2192 waits for specific condition<\/li>\n\n\n\n<li>Fluent Wait \u2192 customizable<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Best practice:<br>Use <strong>Explicit Wait<\/strong> for better control.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-7 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>6. Difference between Implicit and Explicit Wait<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Implicit wait is applied globally and waits for all elements, whereas explicit wait is applied to specific elements based on conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Wait until element is clickable<\/li>\n\n\n\n<li>Wait until element is visible<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Explicit wait is preferred because it is more efficient and avoids unnecessary delays.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-8 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>7. How do you handle dropdowns?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dropdowns are handled using the Select class in Selenium when the HTML uses &lt;select&gt; tag.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We can select options using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visible text<\/li>\n\n\n\n<li>Value<\/li>\n\n\n\n<li>Index<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"> For custom dropdowns (non-select):<br>We use click and XPath.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-9 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>8. How do you handle alerts?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Alerts are popups that require user action. Selenium handles them using switchTo().alert().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Operations:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>accept() \u2192 click OK<\/li>\n\n\n\n<li>dismiss() \u2192 click Cancel<\/li>\n\n\n\n<li>getText() \u2192 read message<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Important:<br>You must switch to alert before interacting with it.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-10 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>9. What is StaleElementException?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This exception occurs when the element is no longer attached to the DOM. It usually happens when<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Page refreshes<\/li>\n\n\n\n<li>DOM updates dynamically<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"> Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Re-locate the element<\/li>\n\n\n\n<li>Use explicit wait<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-11 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>10. What is Actions class?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Actions class is used to perform advanced user interactions that cannot be done using simple commands<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Mouse hover<\/li>\n\n\n\n<li>Drag and drop<\/li>\n\n\n\n<li>Right-click<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Used in complex UI scenarios.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-12 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>11. What is JavaScriptExecutor?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">JavaScriptExecutor allows executing JavaScript code inside the browser.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used when:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Selenium cannot click element<\/li>\n\n\n\n<li>Need to scroll page<\/li>\n\n\n\n<li>Handle hidden elements<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; js.executeScript(&#8220;window.scrollBy(0,500)&#8221;);<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-13 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>12. What is Data-Driven Testing?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this approach, test data is stored externally (Excel, CSV, JSON), and tests are executed using different data sets.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Benefits:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Reusability<\/li>\n\n\n\n<li>Multiple test scenarios<\/li>\n\n\n\n<li>Better coverage<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-14 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>13. How do you handle failures in automation?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Failures are handled using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Retry mechanism<\/li>\n\n\n\n<li>Screenshot capture<\/li>\n\n\n\n<li>Logging (Log4j)<\/li>\n\n\n\n<li>Reports (Extent Reports)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-15 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>14. What are the different types of navigation commands?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Navigation commands are used to move between pages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>get() \u2192 open URL<\/li>\n\n\n\n<li>navigate().to() \u2192 go to URL<\/li>\n\n\n\n<li>navigate().back() \u2192 go back<\/li>\n\n\n\n<li>navigate().forward() \u2192 go forward<\/li>\n\n\n\n<li>navigate().refresh() \u2192 refresh page&nbsp;<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-16 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>15. What is the difference between findElement and findElements?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;findElement \u2192 returns a single element, throws exception if not found<\/li>\n\n\n\n<li>&nbsp;findElements \u2192 returns a list of elements, returns empty list if not found<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-17 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>16. How do you handle frames in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Frames are handled using switchTo().frame().<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>By index<\/li>\n\n\n\n<li>By name\/id<\/li>\n\n\n\n<li>By WebElement<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-18 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>17. What is Page Factory in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Page Factory is an extension of POM that uses @FindBy annotation to initialize elements.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-19 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>18. What is Fluent Wait?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Fluent Wait is an advanced wait with customizable timeout and polling interval.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;&nbsp;Ignore specific exceptions<\/li>\n\n\n\n<li>&nbsp;&nbsp;Set polling frequency<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-20 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>19. What are common exceptions in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>NoSuchElementException<\/li>\n\n\n\n<li>TimeoutException<\/li>\n\n\n\n<li>StaleElementReferenceException<\/li>\n\n\n\n<li>ElementNotInteractableException<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-21 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>20. How do you capture screenshots in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using TakesScreenshot interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Failure analysis<\/li>\n\n\n\n<li>&nbsp;Reporting<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-22 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>21. How do you scroll a webpage in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using JavaScriptExecutor.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Examples:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;scrollBy()<\/li>\n\n\n\n<li>&nbsp;scrollIntoView()<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-23 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>22. How do you handle multiple windows\/tabs?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Use getWindowHandles() and switchTo().window()<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Store window IDs<\/li>\n\n\n\n<li>&nbsp;Switch between them<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-24 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>23. How do you implement retry logic in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using TestNG RetryAnalyzer or custom logic to rerun failed tests.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-25 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>24. How do you design a scalable automation framework?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Page Object Model<\/li>\n\n\n\n<li>&nbsp;Reusable utilities<\/li>\n\n\n\n<li>&nbsp;Data-driven approach<\/li>\n\n\n\n<li>&nbsp;Proper logging &amp; reporting<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-26 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>25. What is the difference between Hard Assert and Soft Assert?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Hard Assert \u2192 stops execution on failure<\/li>\n\n\n\n<li>&nbsp;Soft Assert \u2192 continues execution and reports all failures at end<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-27 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>26. How do you integrate Selenium with CI\/CD?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Using tools like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Jenkins<\/li>\n\n\n\n<li>&nbsp;GitHub Actions<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Trigger tests on build<\/li>\n\n\n\n<li>&nbsp;Run tests automatically<\/li>\n\n\n\n<li>&nbsp;Generate reports<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-28 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>27. What is logging in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Logging helps track test execution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Tools:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Log4j<\/li>\n\n\n\n<li>&nbsp;SLF4J<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-29 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>28. How do you parameterize tests in TestNG?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;@DataProvider<\/li>\n\n\n\n<li>&nbsp;@Test parameters<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-30 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>29. What are best practices in Selenium automation?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>&nbsp;Use stable locators<\/li>\n\n\n\n<li>&nbsp;Avoid Thread.sleep<\/li>\n\n\n\n<li>&nbsp;Use Page Object Model (POM)<\/li>\n\n\n\n<li>&nbsp;Keep tests independent<\/li>\n\n\n\n<li>&nbsp;Maintain reusable code<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-31 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>30.What is broken link?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A broken link is a hyperlink that does not work or leads to an error page (like 404 Not Found), usually because the target page is missing or invalid.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-32 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>31. What is the difference between driver.close() and driver.quit()?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>driver.close() \u2192 closes current browser window<\/li>\n\n\n\n<li>driver.quit() \u2192 closes all browser windows and ends session<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-33 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>32. What is getText() vs getAttribute()?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>getText() \u2192 gets visible text<\/li>\n\n\n\n<li>getAttribute() \u2192 gets attribute value (like value, href)<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-34 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>33. What is a WebElement?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">WebElement represents an HTML element in Selenium.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used to perform actions like:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>click()<\/li>\n\n\n\n<li>sendKeys()<\/li>\n\n\n\n<li>getText()<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-35 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>34. What is Maven in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Maven is a build automation tool.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Managing dependencies<\/li>\n\n\n\n<li>Running tests<\/li>\n\n\n\n<li>Project structure<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-36 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>35. What is Jenkins in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Jenkins is a CI\/CD tool used to automate test execution.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Scheduling test runs<\/li>\n\n\n\n<li>Integrating with Git<\/li>\n\n\n\n<li>Generating reports<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-37 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>36. How do you check if an element is displayed on the page?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>isDisplayed()<\/li>\n\n\n\n<li>isEnabled()<\/li>\n\n\n\n<li>isSelected()<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Used for validation in test cases<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-38 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>37. What is the difference between click() and submit()?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>click(): Clicks any element<\/li>\n\n\n\n<li>submit(): submit a form<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-39 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>38. How do you handle disabled elements?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Selenium cannot interact directly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use JavaScriptExecutor<\/li>\n\n\n\n<li>Remove disabled attribute<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-40 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>39.What is the difference between getWindowHandle() and getWindowHandles()?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>getWindowHandle(): Returns single window ID<\/li>\n\n\n\n<li>getWindowHandles(): Returns all window IDs<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-41 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>40.How do you handle dynamic tables?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locate table<\/li>\n\n\n\n<li>Use loops for rows and columns<\/li>\n\n\n\n<li>Use dynamic XPath<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-42 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>41.What is the best wait strategy in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Best practice:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use Explicit Wait<\/li>\n\n\n\n<li>Avoid mixing waits<\/li>\n\n\n\n<li>Avoid Thread.sleep()<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-43 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>42. How do you ensure your automation is stable?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Best practices:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use stable locators<\/li>\n\n\n\n<li>Use waits properly<\/li>\n\n\n\n<li>Keep tests independent<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-44 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>44 .How do you handle auto-suggestions (like Google search)?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Enter text<\/li>\n\n\n\n<li>Capture suggestions<\/li>\n\n\n\n<li>Loop and select<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-45 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>45. What is DOM in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">DOM (Document Object Model) represents the structure of a webpage.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locating elements<\/li>\n\n\n\n<li>Understanding hierarchy<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-46 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>46. How do you handle dynamic elements in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dynamic elements change attributes like id or class at runtime.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use relative XPath<\/li>\n\n\n\n<li>Use functions like: contains() ,starts-with()<\/li>\n\n\n\n<li>Use stable attributes<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<br>\/\/input[contains(@id,&#8217;user&#8217;)]<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-47 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>47. What will you do if your script fails randomly?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This is called flaky tests.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approach:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add proper waits (Explicit Wait)<\/li>\n\n\n\n<li>Check synchronization issues<\/li>\n\n\n\n<li>Verify locators<\/li>\n\n\n\n<li>Add logging and screenshots<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-48 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>48. How do you handle file upload in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If input type=&#8221;file&#8221;:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use sendKeys() with file path<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If custom upload:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use AutoIT or Robot class<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-49 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>49. How do you handle file download?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Selenium cannot directly handle OS-level downloads.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set browser download preferences<\/li>\n\n\n\n<li>Verify file in download folder<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-50 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>50. How do you validate broken links?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Get all links using findElements(By.tagName(&#8220;a&#8221;))<\/li>\n\n\n\n<li>Use HTTP connection<\/li>\n\n\n\n<li>Check response code<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Codes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>200 \u2192 OK<\/li>\n\n\n\n<li>404 \u2192 Broken<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-51 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>51. How do you scroll to a specific element?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using JavaScriptExecutor:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">scrollIntoView()<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-52 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>52. How do you handle shadow DOM elements?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Shadow DOM elements are hidden inside shadow root.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use JavaScriptExecutor<\/li>\n\n\n\n<li>Access shadowRoot<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-53 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>53. What is the difference between driver.get() and driver.navigate().to()?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">get():<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Waits for page load<\/li>\n\n\n\n<li>Used for initial load<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">navigate().to():<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Similar but used for navigation<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-54 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>54. How do you run tests in parallel in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using TestNG:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>parallel=&#8221;methods&#8221; or &#8220;classes&#8221; in XML<\/li>\n\n\n\n<li>Use Selenium Grid<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-55 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>55. How do you manage test data?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Excel (Apache POI)<\/li>\n\n\n\n<li>JSON<\/li>\n\n\n\n<li>DataProvider in TestNG<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-56 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>56. How do you handle stale element exceptions in real projects?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Re-locate element<\/li>\n\n\n\n<li>Use Explicit Wait<\/li>\n\n\n\n<li>Avoid storing WebElement for long<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-57 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>57. What challenges did you face in automation?<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Dynamic elements<\/li>\n\n\n\n<li>Synchronization issues<\/li>\n\n\n\n<li>Browser compatibility<\/li>\n\n\n\n<li>Slow execution<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-58 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>58. How do you identify if an element is not clickable?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Visibility<\/li>\n\n\n\n<li>Enabled state<\/li>\n\n\n\n<li>Overlapping elements<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Use:<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Explicit Wait \u2192 elementToBeClickable<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-59 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>59. How do you debug a failed test case?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check logs<\/li>\n\n\n\n<li>Check screenshots<\/li>\n\n\n\n<li>Re-run test<\/li>\n\n\n\n<li>Validate locators<\/li>\n\n\n\n<li>Check environment<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-60 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>60. How do you handle cookies in Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Methods:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>addCookie()<\/li>\n\n\n\n<li>getCookies()<\/li>\n\n\n\n<li>deleteCookie()<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-61 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>61. How do you integrate your framework with CI\/CD?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Push code to Git<\/li>\n\n\n\n<li>Configure Jenkins job<\/li>\n\n\n\n<li>Trigger build<\/li>\n\n\n\n<li>Run tests<\/li>\n\n\n\n<li>Generate report<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-62 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>62. How do you capture screenshots only on failure?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>TestNG listeners (ITestListener)<\/li>\n\n\n\n<li>Take screenshot in onTestFailure()<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-63 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>63. What is the difference between Absolute and Relative path?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Absolute:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Full path<\/li>\n\n\n\n<li>Not stable<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Relative:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Flexible<\/li>\n\n\n\n<li>Recommended<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-64 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>64. Your test works in Chrome but fails in Firefox. What will you do?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Possible reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Different browser behavior<\/li>\n\n\n\n<li>Locator compatibility issues<\/li>\n\n\n\n<li>Timing issues<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use cross-browser compatible locators<\/li>\n\n\n\n<li>Add explicit waits<\/li>\n\n\n\n<li>Use browser-specific options if needed<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-65 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>65. Element is visible but Selenium is unable to click it. Why?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Possible causes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Element overlapped by another element<\/li>\n\n\n\n<li>Element not clickable yet<\/li>\n\n\n\n<li>Hidden behind loader<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use Explicit Wait \u2192 elementToBeClickable<\/li>\n\n\n\n<li>Scroll into view<\/li>\n\n\n\n<li>Use JavaScriptExecutor click as fallback<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-66 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>66. Your XPath is correct but still element is not found. What could be wrong?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Element inside iframe<\/li>\n\n\n\n<li>Element inside shadow DOM<\/li>\n\n\n\n<li>Page not fully loaded<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Switch to frame<\/li>\n\n\n\n<li>Handle shadow root<\/li>\n\n\n\n<li>Use wait<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-67 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>67. How do you automate a page where elements load after scrolling?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use JavaScriptExecutor to scroll<\/li>\n\n\n\n<li>Load elements dynamically<\/li>\n\n\n\n<li>Use loop until element appears<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-68 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>68. How do you handle a situation where element ID changes every time?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use contains() or starts-with()<\/li>\n\n\n\n<li>Use parent-child XPath<\/li>\n\n\n\n<li>Use other stable attributes<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-69 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>69. Your test passes locally but fails in Jenkins. Why?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Common reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Environment difference<\/li>\n\n\n\n<li>Headless mode issues<\/li>\n\n\n\n<li>Timing issues<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Add proper waits<\/li>\n\n\n\n<li>Check environment configs<\/li>\n\n\n\n<li>Add logging<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-70 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>70. How do you design your framework for multiple users\/logins?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use DataProvider<\/li>\n\n\n\n<li>Store test data externally<\/li>\n\n\n\n<li>Parameterize login<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-71 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>71. How do you handle a calendar\/date picker?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Simple \u2192 sendKeys()<\/li>\n\n\n\n<li>Complex \u2192 click through UI<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open calendar<\/li>\n\n\n\n<li>Navigate month\/year<\/li>\n\n\n\n<li>Select date<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-72 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>72. How do you handle pagination (multiple pages)?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Loop through pages<\/li>\n\n\n\n<li>Click \u201cNext\u201d button<\/li>\n\n\n\n<li>Extract data until last page<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-73 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>73. How do you verify if a file is successfully downloaded?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Steps:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Set download directory<\/strong><\/li>\n\n\n\n<li><strong>Check file existence<\/strong><\/li>\n\n\n\n<li><strong>Validate file name<\/strong><\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-74 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>74. What will you do if execution is very slow?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Optimization:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run tests in parallel<\/li>\n\n\n\n<li>Remove Thread.sleep()<\/li>\n\n\n\n<li>Use headless mode<\/li>\n\n\n\n<li>Optimize locators<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-75 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>75. How do you handle dependency between test cases?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Avoid dependency (best practice)<\/li>\n\n\n\n<li>Use TestNG dependsOnMethods if needed<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-76 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>76. How do you test a login page with multiple invalid inputs?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approach:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use DataProvider<\/li>\n\n\n\n<li>Pass multiple datasets<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Example:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Invalid username<\/li>\n\n\n\n<li>Invalid password<\/li>\n\n\n\n<li>Empty fields<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-77 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>77. What if application UI changes frequently?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Solution:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use POM design<\/li>\n\n\n\n<li>Centralize locators<\/li>\n\n\n\n<li>Use stable attributes<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-78 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>78. How do you validate error messages?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Steps:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Capture element text<\/li>\n\n\n\n<li>Compare with expected<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">assertEquals()<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-79 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>79. <\/strong><strong>What are the test types supported by Selenium?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For testing web-based applications, Selenium can be used.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The test types supported by Selenium are:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Functional testing: It verifies if each function of a software application performs in accordance with specific requirements. This testing primarily involves black-box testing, and it is not concerned with the source code of the application.<\/li>\n\n\n\n<li>\u00a0Regression testing: It is nothing but a full or partial selection of the already executed\u00a0test cases to be re-executed to ensure that the existing functionalities work fine.<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-80 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>80. In Selenium, what are breakpoints and start points?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Breakpoints: Breakpoints are used to stall the execution of the test. The execution will stop whenever a breakpoint is implemented, and this will help us check whether the code is working properly or not.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Start points: Start points are the points from where the execution should begin. Start points can be\u00a0used when we want to run the test script from the middle of the code or after a breakpoint.<\/p>\n\n\n\n<p class=\"has-text-color has-link-color has-medium-font-size wp-elements-81 wp-block-paragraph\" style=\"color:#ff8d00\"><strong>81. What is DOM inspection?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>I<\/strong>nspecting webpage structure using browser DevTools.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Locators<\/li>\n\n\n\n<li>XPath<\/li>\n\n\n\n<li>CSS selectors<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-82\" style=\"color:#ff8d00\"><strong>82. What are the latest features in Selenium 4?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Features:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Relative locators<\/li>\n\n\n\n<li>Selenium Manager<\/li>\n\n\n\n<li>Improved Grid<\/li>\n\n\n\n<li>Better DevTools support<\/li>\n\n\n\n<li>New window\/tab handling<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-83\" style=\"color:#ff8d00\"><strong>83. What is smoke suite in automation?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Small set of critical test cases executed after every build.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Purpose:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Verify build stability quickly.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-84\" style=\"color:#ff8d00\"><strong>84. What is a locator strategy hierarchy?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Preferred locator order:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>ID<\/li>\n\n\n\n<li>Name<\/li>\n\n\n\n<li>CSS Selector<\/li>\n\n\n\n<li>XPath<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">Because IDs are fastest and most stable.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-85\" style=\"color:#ff8d00\"><strong>85. What are flaky tests?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Tests that:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pass sometimes<\/li>\n\n\n\n<li>Fail sometimes<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Reasons:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Timing issues<\/li>\n\n\n\n<li>Dynamic elements<\/li>\n\n\n\n<li>Environment instability<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-86\" style=\"color:#ff8d00\"><strong>86. How do you reduce flaky tests?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use explicit waits<\/li>\n\n\n\n<li>Stable locators<\/li>\n\n\n\n<li>Retry mechanism<\/li>\n\n\n\n<li>Proper synchronization<\/li>\n\n\n\n<li>Independent tests<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-87\" style=\"color:#ff8d00\"><strong>87. What metrics do you track in automation?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Pass\/fail percentage<\/li>\n\n\n\n<li>Automation coverage<\/li>\n\n\n\n<li>Execution time<\/li>\n\n\n\n<li>Defect leakage<\/li>\n\n\n\n<li>Stability rate<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-88\" style=\"color:#ff8d00\"><strong>88. What reporting tools are used with Selenium?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Popular reporting tools:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Extent Reports<\/li>\n\n\n\n<li>Allure Reports<\/li>\n\n\n\n<li>TestNG Reports<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-89\" style=\"color:#ff8d00\"><strong>89. What is Extent Report?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Advanced HTML reporting library used for:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Logs<\/li>\n\n\n\n<li>Screenshots<\/li>\n\n\n\n<li>Execution reports<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-90\" style=\"color:#ff8d00\"><strong>90. What is the difference between verification and validation?<\/strong><\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong><em>Verification<\/em><\/strong><\/td><td><strong><em>Validation<\/em><\/strong><\/td><\/tr><tr><td><em>C<\/em>hecks whether product is built correctly<\/td><td>Checks whether correct product is built<\/td><\/tr><tr><td>Process-oriented<\/td><td>Product-oriented<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-91\" style=\"color:#ff8d00\"><strong>91. What is ThreadLocal in Selenium?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Used in parallel execution to maintain separate WebDriver instances per thread.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Example use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Parallel test execution in TestNG<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-92\" style=\"color:#ff8d00\"><strong>92. How do you automate OTP-based login?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Usually OTP is not automated directly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Approaches:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Disable OTP in test environment<\/li>\n\n\n\n<li>Fetch OTP from database\/API\/email<\/li>\n\n\n\n<li>Use static OTP in lower environments<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-93\" style=\"color:#ff8d00\"><strong>93. What if developer changes locator frequently?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Use relative XPath\/CSS<\/li>\n\n\n\n<li>Coordinate with developers<\/li>\n\n\n\n<li>Add stable attributes like data-testid<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-94\" style=\"color:#ff8d00\"><strong>94. How do you validate large datasets in UI?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Database comparison<\/li>\n\n\n\n<li>API validation<\/li>\n\n\n\n<li>Dynamic table handling<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-95\" style=\"color:#ff8d00\"><strong>95. What if test data is unavailable?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Approaches:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Generate test data dynamically<\/li>\n\n\n\n<li>Use APIs\/database<\/li>\n\n\n\n<li>Mock services<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-96\" style=\"color:#ff8d00\"><strong>96. How do you manage secrets\/passwords in framework?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Never hardcode credentials.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Environment variables<\/li>\n\n\n\n<li>Vault tools<\/li>\n\n\n\n<li>Encrypted config<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-97\" style=\"color:#ff8d00\"><strong>97. How do you validate images on webpage?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Check:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Image displayed<\/li>\n\n\n\n<li>HTTP response<\/li>\n\n\n\n<li>Natural width > 0<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-98\" style=\"color:#ff8d00\"><strong>98. How do you handle hidden elements?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Using:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JavaScriptExecutor<\/li>\n\n\n\n<li>Actions class<\/li>\n\n\n\n<li>Wait until visible<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-99\" style=\"color:#ff8d00\"><strong>99.What will you do if there are no unique locators?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Relative XPath<\/li>\n\n\n\n<li>Parent-child relationship<\/li>\n\n\n\n<li>CSS hierarchy<\/li>\n\n\n\n<li>Multiple attributes<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-text-color has-link-color has-medium-font-size wp-elements-100\" style=\"color:#ff8d00\"><strong>100. What is a Keyword-Driven Framework?<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">A Keyword-Driven Framework is an automation framework where test actions are represented using predefined keywords like <code>Click<\/code>, <code>Type<\/code>, and <code>Login<\/code>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The test data, locators, and actions are maintained separately from the test scripts, making the framework more reusable, maintainable, and easy to understand.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Top Selenium Interview Questions &amp; Answers 1. What are Locators in Selenium? Locators are used to identify web elements on a webpage so that Selenium can interact with them. 2. What is XPath, and what are the types of XPath? XPath is a locator strategy used to navigate through XML\/HTML DOM structure. Types: XPath is &#8230; <a title=\"Selenium Interview Questions &amp; Answers\" class=\"read-more\" href=\"https:\/\/logicnextgen.com\/tutorials\/automation-testing-interview-questions\/\" aria-label=\"Read more about Selenium Interview Questions &amp; Answers\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-136","page","type-page","status-publish"],"_links":{"self":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/comments?post=136"}],"version-history":[{"count":79,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/136\/revisions"}],"predecessor-version":[{"id":627,"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/pages\/136\/revisions\/627"}],"wp:attachment":[{"href":"https:\/\/logicnextgen.com\/tutorials\/wp-json\/wp\/v2\/media?parent=136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}