Selenium Multiple Select and Matching Questions
Selenium Multiple Select and Matching Questions
Chapter 1 - Basics
Q1. Which of the following statements are true regarding Selenium WebDriver?
Q3. Which of the following limitations are commonly associated with Selenium for automation testing?
Q4. A project manager is discussing an e-commerce project with stakeholders. They emphasize the need to conduct rigorous regression
testing. Which Selenium components or tools would be most appropriate in this case?
Q5. A QA team is considering using Selenium for performance testing. Which of the following are important considerations?
Answer:
Selenium IDE - 1
Selenium WebDriver - 2
Selenium Grid - 3
Selenium RC - 4
Answer:
Functional Testing - 1
Performance Testing - 2
Cross-Browser Testing - 3
Mobile Application Testing - 4
Here’s a more in-depth series of questions to cover tricky options and commonly misunderstood concepts. These questions target the most likely areas for confusion, giving you a strong grasp of the essentials needed for
your exam.
Multiple-Selection Questions
Q1. When configuring Selenium Grid for a cross-platform e-commerce application, which of the following configurations should you
consider to ensure optimal test coverage?
Q2. In the Selenium WebDriver framework, which of the following methods can be used to wait for an element to be clickable?
Q3. Which Selenium WebDriver capabilities should be utilized to handle dynamic web elements that change frequently across sessions in
an enterprise application?
Q4. Which limitations are common when using Selenium for automation in enterprise applications with complex user interfaces?
A. Selenium may struggle with elements in iframes and dynamic loading components.
B. Selenium supports direct testing of desktop applications without any extensions.
C. Selenium may face issues with non-browser-based pop-ups and alerts.
D. Selenium WebDriver can’t automate functionalities dependent on hardware components.
Correct Answers: A, C, and D
Explanation: Selenium can’t handle non-browser-based pop-ups directly and may struggle with hardware-dependent functionalities. Desktop applications are out of scope without third-party tools like WinAppDriver.
Q5. Which of the following accurately describes a recommended practice for using Selenium WebDriver in regression testing?
Answer:
WebDriverWait - 1
RemoteWebDriver - 2
Actions Class - 3
FluentWait - 4
Q2. Match the Testing Type to the Most Suitable Selenium Tool
Testing Type Suitable Selenium Tool
Cross-Browser Testing 1. Selenium Grid
Data-Driven Testing 2. WebDriver with external data sources
Exploratory Testing 3. Selenium IDE
Compatibility Testing 4. Combination of WebDriver and Grid
Answer:
Cross-Browser Testing - 1
Data-Driven Testing - 2
Exploratory Testing - 3
Compatibility Testing - 4
Q3. Match the Situation with the Most Appropriate Selenium Component
Answer:
Recording quick test scenarios - 1
Running tests across various OS - 2
Managing legacy browser compatibility - 3
Writing complex browser interactions - 4
Answer:
Limited desktop application testing - 1
Limited support for handling file uploads - 2
Difficulty in testing mobile interfaces - 3
Challenges with dynamic element identification - 4
Scenario-Based Questions
Q1. A lead developer suggests using Selenium for both automation and performance testing to save time on an e-commerce project. As
the QA specialist, what points should you bring up? (Choose all that apply)
Q2. During a project planning session, a manager wants to avoid writing new test scripts by reusing scripts from Selenium IDE directly in
WebDriver for regression testing. What challenges might this present? (Choose all that apply)
Here’s a thorough set of questions covering the remaining essential 50% of Selenium concepts. These focus on nuances and real-world situations to ensure your understanding of the broad functionality of Selenium and
how it applies to enterprise automation challenges.
Multiple-Selection Questions
Q1. A team is preparing to implement Selenium for automated regression testing in a healthcare application. What are important
considerations in this context?
A. Ensuring Selenium scripts are compliant with regulatory standards (e.g., HIPAA).
B. Using Selenium for accessibility testing to ensure ADA compliance.
C. Creating modular test scripts to quickly update changing UI elements.
D. Using WebDriver for data-driven testing, ensuring test coverage across various data scenarios.
Correct Answers: A, C, and D
Explanation: Regulatory compliance and modular scripts are critical in healthcare applications, and data-driven testing ensures a wide range of scenarios. Accessibility testing requires specialized tools beyond
Selenium.
Q2. Which practices should be avoided when using Selenium to prevent flaky tests in a financial application?
Q3. Which of the following statements about Selenium WebDriver are accurate in the context of enterprise-level test automation?
Q4. Which scenarios benefit the most from integrating Selenium with CI/CD tools like Jenkins?
Answer:
Regression Testing - 1
Parallel Testing - 2
Performance Monitoring - 3
Exploratory Testing - 4
Answer:
WebDriver - 1
Grid - 2
IDE - 3
RC - 4
Scenario-Based Questions
Q1. A client expresses concerns about the stability of tests in an automation suite. They’ve observed that many tests fail inconsistently
due to timing issues in an enterprise application. As the lead QA, which steps could you take to address this?
Q2. During a project kickoff meeting, the project manager suggests using Selenium WebDriver for the full scope of testing, including
mobile, desktop, and database tests. As the automation expert, which limitations should you highlight?
Q3. During testing, a developer suggests handling page load waits by simply increasing the implicit wait time globally. How should you
respond, considering best practices?
Q4. A QA team lead is proposing a test strategy for a retail web application that heavily relies on real-time user interactions. Which of
the following approaches should be integrated into the automation plan?
A. Use the Page Object Model for better code structure and maintainability.
B. Set up Selenium Grid to ensure cross-browser testing with varying resolutions.
C. Rely only on record-and-replay functionality of Selenium IDE for faster test creation.
D. Implement headless browser testing for faster execution in CI/CD.
Correct Answers: A, B, and D
Explanation: POM and cross-browser testing on Grid add robustness and coverage. Headless browsers speed up CI/CD. Solely relying on Selenium IDE is insufficient for comprehensive testing in dynamic
applications.
Q1. When using the WebDriver Interface, which of the following methods are helpful in ensuring an efficient test flow?
Q2. In a test for a web application with multiple windows, which WebDriver methods are essential to manage window switching?
A. switchTo().window(String windowName)
B. navigate().to(String URL)
C. getWindowHandles() to get all open windows.
D. findElement(By.windowName)
Correct Answers: A and C
Explanation: switchTo().window() switches between windows, and getWindowHandles() helps retrieve handles for all open windows. navigate().to() opens a URL but doesn’t switch windows, and
findElement(By.windowName) is not a valid syntax.
Q3. Which of the following statements about handling browser elements with WebDriver are accurate?
A. Absolute XPath
B. CSS Selectors based on dynamic attributes
C. Relative XPath with partial match conditions
D. Tag Name locator for unique tag elements
Correct Answers: B and C
Explanation: CSS Selectors with dynamic attributes and relative XPath help target changing elements more reliably than absolute XPaths. The Tag Name locator is useful but not for dynamic elements.
Q5. When managing waits in a WebDriver script, which practices help reduce flakiness and improve efficiency?
A. Use only Implicit Waits set once at the beginning of the script.
B. Combine Explicit Waits for specific elements with shorter Implicit Waits.
C. Set very high Implicit Wait times to avoid missing element loads.
D. Use FluentWait to handle elements that appear at unpredictable times.
Correct Answers: B and D
Explanation: Combining Explicit Waits with shorter Implicit Waits is efficient, while FluentWait is ideal for handling dynamically appearing elements. Excessive Implicit Wait times can slow tests unnecessarily.
Answer:
get() - 1
navigate().back() - 2
quit() - 3
switchTo().alert() - 4
close() - 5
Answer:
click() - 1
sendKeys() - 2
getAttribute() - 3
isSelected() - 4
isEnabled() - 5
Answer:
Implicit Wait - 1
Explicit Wait - 2
Fluent Wait - 3
Scenario-Based Questions
Q1. You’re automating a retail application with multiple pop-ups and dynamic banners. Which of the following strategies will ensure your
tests run smoothly?
Q2. A web application you’re testing uses frames extensively, requiring interaction within specific frames on the page. How would you
handle frame-based testing in Selenium WebDriver?
Q3. Your team is building a test suite for an enterprise e-commerce website with a heavily customized UI. They need flexibility to handle
elements with changing attributes, styles, and responsiveness. Which WebDriver features should you recommend?
Q4. A client requests you test an application for compatibility across various browsers (Chrome, Firefox, and Edge). They also expect you
to handle alerts, frames, and window switching in the test flow. What should you consider?
Q1. When using WebDriver’s Explicit Wait, which of the following conditions are effective for elements that load dynamically?
A. elementToBeClickable(By locator)
B. presenceOfAllElementsLocatedBy(By locator)
C. textToBePresentInElementValue(By locator, String text)
D. alertIsPresent()
Correct Answers: A, B, and D
Explanation: elementToBeClickable and presenceOfAllElementsLocatedBy are commonly used for dynamic content, and alertIsPresent handles dynamically appearing alerts. textToBePresentInElementValue is
specific to input fields rather than general dynamic elements.
Q2. If you encounter a stale element exception, which approaches help prevent this issue in Selenium?
Q3. Which of the following WebDriver commands are beneficial for interacting with forms and form validation testing?
Q4. Which WebDriver methods should be used for handling iframes embedded within a page?
A. switchTo().frame(int index)
B. switchTo().frame(WebElement frameElement)
C. switchTo().parentFrame()
D. switchTo().window(String windowName)
Correct Answers: A, B, and C
Explanation: switchTo().frame() accepts both index and WebElement references to switch frames, while switchTo().parentFrame() exits the current frame. switchTo().window() is for switching windows, not
frames.
Q5. Which of the following are recommended practices for maximizing test efficiency with Selenium waits?
A. Use only Explicit Waits where needed instead of relying solely on Implicit Waits.
B. Set both Implicit and Explicit Waits for maximum wait efficiency.
C. Implement FluentWait for elements that load irregularly.
D. Adjust wait times based on element visibility for quicker interactions.
Correct Answers: A, C, and D
Explanation: Relying on Explicit Waits with tailored times is more efficient, while FluentWait is useful for variable-loading elements. Combining Implicit and Explicit Waits can cause unexpected issues.
Match the Following Questions
Answer:
ID - 1
Class Name - 2
XPath - 3
CSS Selector - 4
LinkText - 5
Answer:
Implicit Wait - 1
Explicit Wait - 2
Fluent Wait - 3
Answer:
Testing navigation - 1
Switching to alerts - 2
Handling input fields - 3
Closing all instances - 4
Scenario-Based Questions
Q1. You’re testing a finance application where a specific tab on the page only loads data after a certain delay. How would you handle
waiting for this tab to become available?
Q2. You are automating an e-commerce site with search functionality, where the page layout changes based on the items found. Which
WebDriver approach would be effective for validating search results dynamically?
Q3. While testing a banking application with complex user authentication, you encounter an iframe for secure input fields. Which steps
ensure you can interact with these fields correctly?
Q5. In your automation suite, you frequently encounter JavaScript alerts on various pages of the application. What approach will
streamline handling these alerts?
Certainly, let's dive into the final 30% with a focus on the most nuanced aspects of Selenium and WebDriver commands that often present real-world challenges. These questions will emphasize tricky command usage,
advanced scenarios with waits, browser navigation, and project-related challenges.
Multiple-Selection Questions
Q1. Which of the following are true regarding handling browser navigation in Selenium WebDriver?
Q2. When switching between multiple browser windows, which of the following are essential considerations?
Q3. Which WebDriver techniques are effective when dealing with shadow DOM elements?
Q4. For achieving the most reliable interaction with dynamic web elements, which practices are effective?
Q5. Which of the following WebDriver commands are essential for handling alerts that appear intermittently on a page?
Method Function
sendKeys() 1. Enters text into input fields
getTitle() 2. Retrieves the page title
Method Function
getText() 3. Extracts visible text of elements
getAttribute() 4. Gets specific attribute values
isEnabled() 5. Checks if the element is interactive
Answer:
sendKeys() - 1
getTitle() - 2
getText() - 3
getAttribute() - 4
isEnabled() - 5
Answer:
Implicit Wait - 1
Explicit Wait - 2
Fluent Wait - 3
Answer:
XPath - 1
CSS Selector - 2
LinkText - 3
Class Name - 4
Scenario-Based Questions
Q1. During a Selenium automation test, you encounter an element located inside an iframe that only becomes available after a delay.
Which actions are best for successful interaction?
Q2. You need to interact with an alert that appears unexpectedly on multiple pages of an application. How would you handle it
effectively in Selenium?
Q3. You’re testing navigation within a multi-step form where each step loads a different page. Which WebDriver commands are useful for
managing this?
Q4. Your test suite involves interacting with elements that often change dynamically. Which WebDriver features or commands best
handle this situation?
Q5. During testing, you must handle elements that are only partially visible due to scrolling requirements. Which WebDriver options
handle such elements effectively?
A. executeScript("arguments[0].scrollIntoView(true);", element)
B. Use Explicit Wait with elementToBeClickable() for the scrolled element.
C. Rely on Implicit Waits to manage the scrolling and delay.
D. Use sendKeys(Keys.PAGE_DOWN) to scroll manually if required.
Correct Answers: A, B, and D
Explanation: JavaScript Executor scrolls to elements, Explicit Waits confirm readiness, and manual scrolling can help in tricky cases. Implicit Waits don’t specifically manage scrolling.
Q2. Which TestNG features are useful for organizing and optimizing test suite execution?
Q3. In Page Object Model (POM), which of the following are considered best practices?
Q4. When setting up Data-Driven Testing using Apache POI with TestNG, which practices are effective?
Q5. Which CSS selectors can identify elements more efficiently than XPath for frequently changing web applications?
Annotation Description
@Test 1. Marks a method as a test case
@BeforeClass 2. Runs once before any method in the class
@AfterMethod 3. Executes after each individual test method
@BeforeSuite 4. Runs once before the entire suite
@AfterTest 5. Runs after all methods in the class, within a test tag
Answer:
@Test - 1
@BeforeClass - 2
@AfterMethod - 3
@BeforeSuite - 4
@AfterTest - 5
Answer:
contains() - 1
text() - 2
starts-with() - 3
last() - 4
Q3. Match the TestNG Assertion Method with Its Use Case
Answer:
assertTrue() - 1
assertEquals() - 2
assertNotNull() - 3
assertFalse() - 4
Answer:
ID - 1
Name - 2
LinkText - 3
CSS Selector - 4
Scenario-Based Questions
Q1. In a large TestNG suite, you need to run only a select group of tests. Which TestNG configurations allow you to accomplish this
effectively?
A. Group the tests using @Test(groups="groupName") and specify the group in TestNG XML.
B. Use include and exclude tags within the TestNG XML to specify which methods to run.
C. Run the entire suite and rely on priority to control test order.
D. Disable unused tests by commenting out methods in the TestNG XML file.
Correct Answers: A and B
Explanation: Grouping and XML include / exclude tags are efficient. Running the full suite or commenting methods is inefficient and can cause maintenance issues.
Q2. You’re using data-driven tests in TestNG with Apache POI to pull data from Excel files. Which strategies help maintain good test
performance and prevent memory issues?
A. Open and read the Excel file only once before the test suite.
B. Load Excel data in a DataProvider method rather than individual tests.
C. Use try-with-resources to automatically close file streams.
D. Implement Implicit Waits within the data reading code.
Correct Answers: A, B, and C
Explanation: Reading the file once, using DataProvider , and closing resources are best practices. Implicit Waits don’t apply to data handling.
Q3. When would you prefer CSS selectors over XPath in Selenium, considering both performance and maintainability?
Q4. In a TestNG project with a Page Object Model structure, you encounter that elements in one page occasionally change IDs based on
the user login. How can you manage this efficiently?
A. Add conditional locators within the page class to handle different IDs.
B. Use @FindBy annotations with all possible IDs listed in @FindAll .
C. Introduce a helper method within the page class that selects the appropriate locator.
D. Avoid using Page Object Model for such scenarios to minimize complexity.
Correct Answers: A and C
Explanation: Conditional locators and helper methods allow flexibility without abandoning the Page Object Model. @FindAll isn’t effective with dynamic IDs, and avoiding POM isn’t recommended for structured
projects.
Q5. You are configuring parallel execution in TestNG. Which of the following are critical to managing parallel execution safely?
Multiple-Selection Questions
Q1. When configuring TestNG XML files for a large suite with multiple classes and packages, which practices improve organization and
execution efficiency?
A. Use <suite> tags to define the scope of the suite and its configuration.
B. Define <test> tags within <suite> for organizing different groups of test classes.
C. Assign each test class to a separate XML file for modularity.
D. Define <parameter> tags inside <suite> to pass values to test methods dynamically.
Correct Answers: A, B, and D
Explanation: <suite> and <test> tags improve organization, while <parameter> supports dynamic data. Separate XML files per class are generally inefficient.
Q2. When using @DataProvider in TestNG for data-driven tests, which methods help optimize test performance and organization?
Q3. Which TestNG assertions are best for validating multiple scenarios in complex, data-driven tests?
Q4. In Page Object Model (POM), which strategies ensure efficient handling of dynamic data and frequent UI changes?
Q5. Which TestNG configurations are required for parallel test execution with minimal conflicts?
Answer:
@BeforeSuite - 1
@AfterSuite - 2
@BeforeMethod - 3
@AfterClass - 4
Answer:
get() - 1
navigate().back() - 2
quit() - 3
findElement() - 4
Class Function
XSSFWorkbook 1. Represents an Excel workbook (XLSX format)
XSSFSheet 2. Represents a specific sheet in the workbook
XSSFRow 3. Represents a row in the sheet
XSSFCell 4. Represents an individual cell in a row
Answer:
XSSFWorkbook - 1
XSSFSheet - 2
XSSFRow - 3
XSSFCell - 4
Answer:
text() - 1
starts-with() - 2
last() - 3
contains() - 4
Assertion Use
assertEquals() 1. Compares two values for equality
assertNotNull() 2. Verifies that an object is not null
assertTrue() 3. Checks if a condition is true
assertSame() 4. Confirms two object references point to the same object
Answer:
assertEquals() - 1
assertNotNull() - 2
assertTrue() - 3
assertSame() - 4
Scenario-Based Questions
Q1. You need to run multiple tests across different browsers simultaneously in a CI/CD environment. Which settings in TestNG XML and
WebDriver setup can support this?
Q2. In a large suite with complex locators, what strategies can improve test reliability and maintainability?
Multiple-Selection Questions
Q1. When configuring parallel test execution in TestNG with Apache POI for data-driven testing, what practices ensure accurate data
handling across threads?
Q2. In Page Object Model (POM) structures, which techniques support maintainable and flexible automation scripts for complex web
applications?
Q3. Which types of data validation are best managed by assertions in TestNG for comprehensive test coverage?
A. Checking that a page element is visible and contains the correct text.
B. Confirming two objects point to the same memory reference.
C. Verifying that specific elements have unique attribute values.
D. Ensuring each list item contains expected data based on external sources.
Correct Answers: A, B, C, and D
Explanation: Assertions are versatile for visibility, content, uniqueness, and external data checks, crucial for thorough validation in automation.
Q4. When handling dynamic elements that frequently change position or ID, which approaches with XPath and CSS Selectors ensure
reliable test execution?
A. Use contains() and starts-with() XPath functions for partially matching attributes.
B. Prefer CSS Selectors with direct attribute values for better performance.
C. Combine multiple attributes in a single XPath to improve accuracy.
D. Avoid absolute XPath as it’s susceptible to layout changes.
Correct Answers: A, C, and D
Explanation: Partial and combined attribute matching, along with avoiding absolute XPath, enhances stability with dynamic elements. Direct CSS selectors can be unstable with dynamic attributes.
Q5. In data-driven testing using Apache POI, which methods best support efficient reading and writing of large Excel files?
Annotation Use
@BeforeClass 1. Runs once before any method in the class
@AfterMethod 2. Runs after each test method in the current class
@DataProvider 3. Supplies external data to test methods
@Parameters 4. Passes XML parameters to test methods
Answer:
@BeforeClass - 1
@AfterMethod - 2
@DataProvider - 3
@Parameters - 4
Answer:
SXSSFWorkbook - 1
XSSFSheet - 2
XSSFFormulaEval - 3
XSSFRow - 4
Answer:
ID - 1
XPath - 2
CSS Selector - 3
Class Name - 4
Answer:
position() - 1
contains() - 2
ancestor - 3
last() - 4
Answer:
methods - 1
classes - 2
tests - 3
none - 4
Scenario-Based Questions
Q1. During parallel testing in TestNG, you encounter inconsistent data states across threads. Which configurations best mitigate these
issues?
Q2. In an automation framework, you need to dynamically locate elements with unstable IDs. Which locator strategies offer the most
reliable results?
Q4. You’re using a Page Object Model (POM) in a highly dynamic UI where page structure changes frequently. Which strategies in your
POM design help handle this?
Chapter 5,6,7
Q1. When using Selenium WebDriver’s JavaScriptExecutor to handle complex interactions, which scenarios are ideal for implementing it?
Q2. What are the primary considerations when configuring Selenium Grid for parallel execution across multiple browsers and operating
systems?
Q3. When automating file uploads in Selenium, which methods effectively handle this functionality across various frameworks and
applications?
A. Use sendKeys() with the file path directly on the file input element.
B. Use JavaScriptExecutor to simulate file selection dialogs.
C. Integrate Robot class for handling native OS file selectors.
D. Use third-party tools to manage file dialogs in restricted environments.
Correct Answers: A, C, and D
Explanation: sendKeys() , Robot class, and third-party tools manage file uploads effectively. JavaScriptExecutor may lack access to file selection dialogs for security reasons.
Q4. When taking screenshots in Selenium for error reporting and validation, which approaches ensure accurate and usable screenshots
in automation?
Q5. When integrating Maven with Selenium projects, which benefits ensure optimized project management and dependency handling?
Q6. In Continuous Integration (CI) setups with Jenkins, which practices best support a stable and responsive test automation pipeline
with Selenium?
Q7. When handling browser cookies in WebDriver for managing sessions across test scenarios, which actions are effective in session
management?
A. Use manage().getCookies() to retrieve all cookies.
B. Use addCookie() to create new cookies for sessions.
C. Use deleteAllCookies() before test execution to prevent conflicts.
D. Use JavaScriptExecutor to manipulate cookies directly in the DOM.
Correct Answers: A, B, and C
Explanation: Managing cookies through WebDriver commands provides full control over sessions, while JavaScriptExecutor is generally unnecessary for basic cookie operations.
Concept Description
Hub 1. Manages test requests and distributes to Nodes
Node 2. Executes tests across different browsers and OS environments
Capability 3. Specifies browser, version, and OS for test execution
Parallel Execution 4. Allows tests to run simultaneously on different Nodes
Answer:
Hub - 1
Node - 2
Capability - 3
Parallel Execution - 4
Answer:
addCookie() - 1
getWindowHandle() - 2
switchTo().frame() - 3
executeScript() - 4
Tool Capability
Jenkins 1. Automates build and deployment pipelines
Maven 2. Manages dependencies and build cycles for Java projects
Log4j 3. Provides logging capabilities for tracking test execution
Git 4. Version control for code tracking and collaboration
Answer:
Jenkins - 1
Maven - 2
Log4j - 3
Git - 4
Component Function
Logger 1. Captures log messages at different levels
Appender 2. Specifies where log messages are sent (e.g., console, file)
Layout 3. Formats log messages before sending to the appender
Level 4. Sets the severity of log messages (e.g., INFO, ERROR)
Answer:
Logger - 1
Appender - 2
Layout - 3
Level - 4
Command Action
git clone 1. Copies a remote repository locally
git commit 2. Saves changes in the local repository
git pull 3. Fetches updates from a remote repository
git push 4. Uploads local commits to the remote repository
Answer:
git clone - 1
git commit - 2
git pull - 3
git push - 4
Scenario-Based Questions
Q1. You are using Selenium Grid to perform cross-browser testing with two Nodes: one for Chrome and another for Firefox. The Chrome
Node frequently fails when a pop-up alert is present. What steps can you take to address this?
Q2. While implementing logging in your Selenium project with Log4j, the team notices that log files quickly become large. What steps
can you take to maintain useful logging without filling up disk space?
Multiple-Selection Questions
Q1. When managing dynamic elements in Selenium, which methods effectively handle elements that change frequently?
Q2. Which practices are recommended for managing large test data files in Data-Driven Testing with Apache POI?
Q3. While setting up a Continuous Integration pipeline with Jenkins and Maven, which steps optimize build and test automation?
Q4. Which statements are true about handling file downloads in Selenium WebDriver?
Q5. When using JavaScriptExecutor for handling complex elements, which methods help execute JavaScript directly in Selenium?
Answer:
@BeforeSuite - 1
@AfterSuite - 2
@BeforeMethod - 3
@AfterMethod - 4
Command Use
click() 1. Clicks on the specified element
sendKeys() 2. Inputs text into text fields
isDisplayed() 3. Checks if an element is visible
getText() 4. Retrieves text from an element
Answer:
click() - 1
sendKeys() - 2
isDisplayed() - 3
getText() - 4
Function Purpose
text() 1. Finds elements by exact text match
contains() 2. Finds elements by partial text match
starts-with() 3. Finds elements where text begins with a certain string
position() 4. Selects elements based on their position in the DOM
Answer:
text() - 1
contains() - 2
starts-with() - 3
position() - 4
Command Function
mvn compile 1. Compiles the project’s source code
mvn clean 2. Deletes all files generated by previous builds
mvn test 3. Runs test cases in the project
mvn install 4. Builds the project and installs it locally
Answer:
mvn compile - 1
mvn clean - 2
mvn test - 3
mvn install - 4
Stage Purpose
Source 1. Downloads the code repository
Build 2. Compiles and prepares the code for testing
Test 3. Executes tests on the compiled code
Deploy 4. Releases the built project to a target environment
Answer:
Source - 1
Build - 2
Test - 3
Deploy - 4
Scenario-Based Questions
Q1. You are automating a web application with Selenium, and one of the pages contains several dynamic elements. What approaches
should you take to ensure consistent interaction with these elements?
Q2. A new Jenkins pipeline was created to run your Selenium tests nightly. During some test cases, screenshots of failed tests aren’t
generated. What steps can you take to ensure consistent screenshot generation?
Q3. Your team needs to add version control for test automation scripts in a Git repository. Which practices will best help manage the
code efficiently?
Q4. You need to handle file uploads on a webpage where standard file upload elements aren’t used. Which methods are suitable for this
situation?