{"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-7a0bedf683b4332293ad00da38a017a4 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-03a7aec21393d90adcd6062f1d16c4ee 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-3899ee12c28d5cf374fff3ab375c8a38 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-cdde827b38d905b0b835b5382284b389 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-25c129cdc791115bf032f450ba1baa1f 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-6bf43f0f16bf00c8c1e02483ad091d11 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-7127c74422a55e2f47ba1a320f476023 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-f31c492bb30b9db0976248fd15664f7e 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-2df366c34a43eae641b15da83958655c 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-f27ece924ebf4caf16b1bce6445b60f9 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-c8d9bba1528c8c60ec57de239bb931b6 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-6123786a9fb6b013452de154330dd66b 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-704786d24e3da2e3f3812bd427869791 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-997a492dd43a1ab5c43c868cdc73c7d0 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-c6cc1ab1ccb370cd832dbcb3970fcaed 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-a4f8b10453b98dcb681dbc06d7ff30d8 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-2d7bb00ad2be41c954dcda3243e18d84 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-5139330bded8efc25eefacdbe5262f2f 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-73ab64a10217ba1830692b3f06fad443 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-138078e61900531e00efa63c7c9b9f28 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-a7044acfdf3c503ad81e51aeca90b2e9 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-f58b698d83ec8cd68b3344db911a8867 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-7431736121e9ff4430a4ed0ee5c9718f 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-20ef8c6ce28a9fb23f48753fbec2fc3e 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-69e583941df5fe80b7d74ec2e9338691 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-912325135fde40d89d20862aed37e8c8 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-41b683eac2a30a1c57f23eadcb365099 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-6b8bc486fa1295c8ffcb8c3bc1647122 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-20db3379d35d86b367be299ccd04dfb1 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-cfdd5db25c6faa71f6ce6639fa0dc3d1 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-91c42eda72b0ef5f1b3fd2d8ac13acef 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-1127dd10251a871a30a19c72a8c1c5bd 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-98609e011067271827ab884b985e66f6 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-0751faa93908c575db016507352b1916 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-894ba4880f41b243a155e5e56835d29b 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-a4cac0de2ca7713e9624d09b849bde54 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-44cc16be940cbd7d31e02698153607b6 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-0a3811041e04a1494daac3ae28899435 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-65b66d10fd6371277a068f6bf990614f 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-0d600550338a39a5f766ecdfbd3cf9bb 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-6e6ebc614b48e1ce6b25ad1f05c990fc 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-e853e0545c52dac6636b432a054df61f 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-0fe55a2080273d99b1999c3795e9ab7d 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-c36d079a21303fef0bd2ed008c31a34c 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-74910dca72e5e58821863172a0c77bc0 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-1db2ec3953a8f78c5db17509aea57683 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-60825f7fa88423005d125343437dd0e1 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-44419519eadd73c057cb934139a8e2e6 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-0a7dccfd7c467478c739a5ee0b1ba2cc 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-43ff7ae8f6e496cca5b0610cd144657a 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-deafb19261fd7bc77950d13f79f38039 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-41701f572b4cdb0f898ac1665d35e840 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-119c1bb974e7bad0f8f98931e5705b71 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-29d5e8d15dec1df202d7ae7eb40ea8e9 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-0415bafb66be81ce2ad115aa1ae9a376 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-6d914f9a6957d328b644195c6c15a3fc 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-75098802fa22cb9d7ac37bffb9f4d68d 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-1b7bb6f670869281d1d2c2a99e147ecb 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-cb5ea86d5eedeaa2f06798af5182e7cb 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-d557dca274d559817321ecb692cd78b9 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-c1367eb6dcff220c822f85cf599810b6 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-2f58c55e154d1691a9ac0ff30631aa0f 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-9436cf5130a0fafd62e4a04d5e1d8d8b 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-5bf602e24217b51aae1db82f0a220901 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-1ec997836d8ee310ecf07a4cf11e39ce 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-801c9b4f5ecd1e87a9309d9f5db73299 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-764e021cba338863eb274dfa37211059 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-e0f370171a86ac7398bca6592f10d18e 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-a615f4462e1d83660f692146a5825f04 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-ba03101d9a93666360b84f3e9d988186 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-14c3ca92c007ac1a37d6c79d7f62d1f7 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-e2aeb30017e50befec2046885f246338 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-3d3105750aa35c5b12f7669f0a46c3b1 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-8098def0400485303ee4561dea0687ad 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-19a81f06f9ce7bef5dadff6b3cce8f35 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-5d84af9b094b0edd06df34ff0afaefea 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-1927e151804298c52dda54f564e48d71 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-7a3b9a422f7fc094d6131affbd3afcf5 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-68b9c8ed94f940265673271e1d69315b 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-4216e480ab1c38627bdf0c2ef4e92117 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-aad4f4653829bce89d82e60449d547bf 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-6b4af3b5b20624c6fbbd084c8a2027de\" 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-bc9e25e4cedfc0eea326f5084534cb81\" 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-66c41e37872fe3b68695e534e26a1f6d\" 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-8baad91154bb7379a567699b31736c77\" 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-207649550fe7ad3764cb2ef7b4975ca3\" 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-d35aecf6a0d2fd57dc47e13c210a5c77\" 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-d807d53f808819818a6c9800dde7c663\" 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-fd8448ff2be354a03739c897aefe59bc\" 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-8819b15ae31a2022b085c24a31d983e0\" 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-0c76d759f59b560e4fdc0558a3e0f220\" 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-c3af748afe5f291602333c33b7bc3b86\" 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-345f6af0657661f2dff1d07e4d267bde\" 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-7434b6a12aedf1b8d04a79843ee00530\" 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-d84b021547e264d4c15f3862db778ce2\" 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-4bbe0f05228995fb2d3653ece6a09c9e\" 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-232c03bf14f3ff4e5899327d7950e345\" 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-159b960bb9a5c99572182fa8b908c762\" 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-a630ca8ecf7b1001d86d837cd1811c26\" 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-e55255d17011d0f794bd8af7d668e7df\" 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}]}}