1.Have you created framework from scratch? Explain architecture.
            Yes, I have built frameworks from scratch using Java, Selenium, TestNG, Maven, and Page Object
            Model. The structure includes:
                ● BaseTest: Driver setup/teardown
                ● Page Layer: Page classes with locators and methods
                ● Utility Layer: Common utilities (Waits, FileReader, etc.)
                ● Test Layer: Test classes with TestNG annotations
                ● Data Layer: Test data in JSON/Excel/Properties
                ● Reports: Extent Reports integration
                                                            til
            2.Which design pattern have you used in your framework?
            I have used:
                                                          Pa
                      •Page Object Model (POM) – Used for page structuring
                      Goal: Keep locators and page actions separate from test logic.
                      Why? It improves code readability, reusability, and maintainability.
                      •Custom Thread-Safe WebDriver Pattern – Used for parallel cross-browser execution
                      Goal: Ensure each test thread has its own WebDriver instance.
            g
                      Why? Using ThreadLocal allows safe parallel execution without driver conflicts, keeping the
                      setup simple and easily traceable with Log4j.
          ra
                      •Factory Pattern – Used for browser setup logic
                      Goal: Dynamically create browser drivers based on the input parameter.
                      Why? Even without a separate class, using if-else to initialize ChromeDriver, FirefoxDriver,
                      etc., is a factory-style approach that makes the code clean and extensible.
        Pa
                      •Observer Pattern – Used for logging and reporting
                      Goal: Monitor and react to test events during execution.
                      Why? Tools like Log4j and TestNG Listeners observe test flow and log results or failures
                      automatically, without altering the main test code.
            3.   What is the difference between Page Object Model (POM) and
            Page Factory?
                ● POM: In POM, we create a separate class for each page and manually define locators using
                      By and initialize elements using driver.findElement().
                      There is no automatic object initialization.
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                     
                ● Page Factory: Page Factory is an enhancement over POM. It uses @FindBy annotations along
                      with PageFactory.initElements() to automatically initialize elements with lazy loading
                      (elements are created only when used
            4.How does Page Factory implement lazy initialization?
            Page Factory uses a technique called lazy initialization through Java Reflection and dynamic proxies.
            When you declare elements with @FindBy and initialize them using PageFactory.initElements(),
            Selenium doesn't immediately find those elements.
            Instead, it creates a proxy object for each WebElement.
            The actual lookup happens only when you interact with the element (like click(), sendKeys()),
            ensuring faster page load and fewer stale element issues.
                                                           til
            5.What is Maven Surefire Plugin?
            Goal:
                                                         Pa
            The Maven Surefire Plugin is used to run your TestNG or JUnit test cases when you run the mvn test
            command.
            To automatically execute your tests during the Maven build process
            Why it's used:
                ● It runs your test cases from testng.xml or JUnit classes.
                ● It generates test reports in the target/surefire-reports folder.
            g
                ● You can configure which tests to run, and even run tests in parallel.
          ra
            6.What is the hierarchy of TestNG annotations?
            @BeforeSuite → @BeforeTest → @BeforeClass → @BeforeMethod → @Test → @AfterMethod →
            @AfterClass → @AfterTest → @AfterSuite
        Pa
            7.How to rerun only failed test cases in TestNG?
            Enable testng-failed.xml generation by Surefire plugin or use RetryAnalyzer to rerun failed tests
            automatically.
            8.How to connect Maven and TestNG?
            Add TestNG dependency in pom.xml and use Maven Surefire Plugin to run TestNG tests via mvn test.
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                   
            9.Parameterization in TestNG?
            Using:
                ● @Parameters annotation with testng.xml
                ● @DataProvider method for multiple sets of data
            10. In TestNG, how do you ensure screenshots are taken only for failed
            test cases?
            Use ITestListener interface and implement onTestFailure() to capture screenshots.
                                                          til
            11. Suppose 49 of 200 tests failed, how would you collect only failed test
            data using TestNG?
            Using listeners or IReporter, fetch failed tests and log/store them separately. Or use testng-
            failed.xml.
                                                        Pa
            12.How to work with configuration files in Selenium framework?
            Use Java Properties class to read key-value pairs from .properties file for reusable configurations like
            URLs, credentials, etc.
            g
            13.Difference between Comparable and Comparator?
          ra
                ● Comparable: Defines natural ordering using compareTo(), implemented in the class itself.
                ● Comparator: Custom order, used externally via compare().
            14.In what scenarios do we use the finally block?
        Pa
            To ensure code execution like closing connections, streams, or quitting WebDriver irrespective of
            exceptions.
            15.What is a Null Pointer Exception?
            Occurs when accessing or modifying a null object reference (e.g., obj.toString() when obj is null).
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                    
            16.Explain Exception hierarchy in Java.
                ● Throwable
                        o Error (JVM errors)
                        o Exception
                                 ▪       Checked (IOException)
                                 ▪       Unchecked (NullPointerException, RuntimeException)
            17.What are Java Streams and their usage?
                                                             til
            Java Streams are used to process collections (like List, Set) in a functional and readable way, without
            using traditional loops.
            Goal:
            Why use Streams?
                ● Reduces boilerplate code
                ● Improves readability
                                                           Pa
            To perform operations like filtering, mapping, sorting, and collecting data in a clean and efficient
            style.
                ● Allows chaining multiple operations in one flow
            g
            18.Sort a HashMap using keys (where one key is null).
          ra
            To sort a HashMap by keys including a null key, you can use a TreeMap with a custom Comparator
            that handles null values.
            Goal:
            Sort the map by keys in natural order, placing null keys first.
        Pa
            Why:
            TreeMap does not allow null keys by default, but you can handle it using Comparator.nullsFirst().
            Example:
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                       
            19.Stairs problem: Find total ways to reach 3rd stair.
            If you're allowed to take only 1 or 2 steps at a time, there are 3 ways to reach the 3rd stair:
                1. 1 → 1 → 1
                                                               til
                2. 1 → 2
                3. 2 → 1
            We use the logic:( Fibonacci logic:)
            ways(n) = ways(n - 1) + ways(n - 2)
            So for 3 stairs:
            ways(3) = ways(2) + ways(1) = 2 + 1 = 3
                                                             Pa
            If the question allows 1, 2, or 3 steps, then you can also directly jump:
            g
                4. 3 (direct jump)
            So in that case, total ways = 4
          ra
            20.How do you choose which test cases to automate?
            I choose test cases that are:
        Pa
                ●       Stable – The functionality is not changing frequently
                ●       High-priority – Core business flows like login, checkout, search
                ●       Repetitive – Tests that are run in every sprint or regression
                ●       Frequently executed – Smoke and regression test cases
                ●       I avoid automating dynamic UI elements or one-time test cases
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                           
            21.Write Selenium code to find broken links on a webpage.
                                                       til
            22.How do you handle multiple frames in Selenium?
            Use driver.switchTo().frame().
            Ways to switch to a frame:
                                                     Pa
            g
          ra
        Pa
            To come out of the frame:
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                   
            23.Print title of 10 links using Selenium.
            To print the text (title) of the first 10 links on a webpage using Selenium:
            24.How to perform file upload in Selenium?
                                                           til
            Use sendKeys():
            driver.findElement(By.id("upload")).sendKeys("C:\\path\\to\\file.txt");
            25.How to take a screenshot using Selenium?
                                                         Pa
            g
            26.How to perform control-click using Actions class?
          ra
        Pa
            27.Difference between driver.get() and driver.navigate().to()?
            Both open URL, but navigate().to() allows back, forward, and refresh operations.
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                                   
            28.What is the "3 Amigos" in Agile?
            A meeting with Developer, Tester, and Product Owner to discuss stories before implementation.
            29.Difference between Scrum and Kanban?
            Scrum:
                ● Work is divided into fixed sprints (usually 1–2 weeks)
                ● Has defined roles (like Scrum Master, Product Owner)
                ● Includes meetings like daily stand-up, sprint planning, and review
            Kanban:
                                                              til
                ● No fixed time frame — work flows continuously
                ● Focuses on visualizing tasks using a board
            30.Smoke vs Sanity vs Regression vs Retesting?
                ● Smoke: Basic checks before full testing.
                                                            Pa
                ● Good for teams that want flexibility and faster delivery
                ● Sanity: After minor changes.
                ● Regression: Ensures no break due to new code.
            g
                ● Retesting: Recheck failed test after bug fix.
          ra
            31.Can we automate CAPTCHA?
            However, in test environments:
                ●
        Pa
                         Developers may disable CAPTCHA or provide a test bypass key
                ● For image-based CAPTCHA, you can take a screenshot and use OCR tools like Tesseract to
                         extract text (but accuracy is not guaranteed)
                ●       It’s not reliable or recommended in production
            32.How to perform data-driven testing in Postman?
            Using Collection Runner with external data files (JSON/CSV).
              Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02
                                                          
            33.What validations do you put in API testing?
               ● Status code
               ● Response time
               ● Schema validation
               ● Field presence
               ● Business logic
            34.Difference between PUT and PATCH HTTP methods?
               ● PUT: Full resource update
                                                       til
               ● PATCH: Partial update to existing resource
                                                     Pa
            g
          ra
        Pa
             Parag Patil | paragpatil.rcpit@gmail.com | 7666170317 | https://topmate.io/parag_patil02