
































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

































Welcome to the comprehensive practice exam for the SeU Certified Selenium Engineer with Java certification. This exam consists of 250 multiple-choice questions designed to mirror the format and difficulty of the actual CSE-Java test, covering the official syllabus topics.
Key Exam Details:
In Selenium Grid, what is the primary role of the Hub? A) Executes tests on multiple browsers simultaneously B) Stores test data and reports C) Receives test requests and distributes them to registered Nodes D) Provides a graphical interface for test creation Answer: C) Receives test requests and distributes them to registered Nodes Explanation: The Hub is the central point that receives test execution requests and forwards them to the appropriate Nodes
Question 3: Which of the following is the correct way to switch to an iframe using its name attribute? A) driver.switchTo().frame("iframeName"); B) driver.switchTo().iframe("iframeName"); C) driver.switchTo().frameByName("iframeName"); D) driver.switchTo().frameById("iframeName"); Answer: A) driver.switchTo().frame("iframeName"); Explanation: The switchTo().frame(String nameOrId) method accepts either the name or the id of the iframe. This is a fundamental Selenium operation for handling embedded content. Reference: SeU CSE Exam – Frame Handling
Question 4: How can you retrieve the value of a CSS property (e.g., background- color) of a WebElement? A) element.getCssValue("background-color"); B) element.getAttribute("background-color"); C) element.getStyle("background-color"); D) element.getProperty("background-color"); Answer: A) element.getCssValue("background-color"); Explanation: The getCssValue(String propertyName) method is used to retrieve the value of a computed CSS property of an element. This is useful for verifying element styling in tests. Reference: SeU CSE Exam – Element Interaction
Question 5:
A) moveToElement(element).click().build().perform(); B) clickAndHold(element).release().build().perform(); C) moveToElement(element).build().perform(); D) doubleClick(element).build().perform(); Answer: C) moveToElement(element).build().perform(); Explanation: To perform a mouse hover, you use moveToElement(element).build().perform();. The .build() method generates the composite action, and .perform() executes it. Hover actions are common for testing dynamic menus. Reference: SeU CSE Exam – Advanced User Interactions
Question 7: What is the correct Maven dependency to use Selenium with Java? A) org.seleniumhq.seleniumselenium- core4.10.0
org.seleniumhq.seleniumselenium- api4.10.0 C) org.seleniumhq.seleniumselenium- java4.10.0 D) org.seleniumhq.seleniumselenium- driver4.10.0 Answer: C) org.seleniumhq.seleniumselenium- java4.10.0 Explanation: The official Maven artifact that bundles all necessary Selenium components for Java is selenium-java under the group org.seleniumhq.selenium. Reference: SeU CSE Exam – Project Setup
To capture a screenshot only when a test fails, which TestNG listener is most appropriate? A) IInvokedMethodListener B) ITestListener C) ISuiteListener D) IExecutionListener Answer: B) ITestListener Explanation: The ITestListener.onTestFailure() method can be overridden to capture a screenshot and perform other actions when a test fails. Reference: SeU CSE Exam – TestNG Listeners
Question 10: What does the @DataProvider annotation in TestNG do? A) Supplies a set of parameters to a test method for multiple iterations
B) Marks a method as a test case C) Configures the test suite execution order D) Generates HTML reports automatically Answer: A) Supplies a set of parameters to a test method for multiple iterations Explanation: @DataProvider methods return Object[][] arrays that feed test methods with different data sets, enabling data-driven testing. Reference: SeU CSE Exam – TestNG Data Provider
Question 11: What is the return type of findElements() in Selenium? A) WebElement B) List C) ArrayList D) Set
Explanation: StaleElementReferenceException occurs when an element that was previously found is no longer attached to the DOM. This commonly happens after page refreshes or dynamic content updates. Reference: SeU CSE Exam – Exception Handling
Question 13: What is the purpose of the driver.quit() method? A) To close the current window B) To close the current tab C) To close all browser windows and end the WebDriver session D) To navigate to a new URL Answer: C) To close all browser windows and end the WebDriver session
Explanation: driver.quit() closes all browser windows associated with the WebDriver instance and ends the WebDriver session, releasing resources. Reference: SeU CSE Exam – WebDriver Lifecycle
Question 14: How do you perform a double-click action using the Actions class? A) actions.doubleClick(element).perform(); B) actions.clickAndHold(element).doubleClick().release().perform(); C) actions.moveToElement(element).doubleClick().perform(); D) actions.click(element).click(element).perform(); Answer: A) actions.doubleClick(element).perform(); Explanation: The Actions class provides a doubleClick(WebElement target) method for performing a double- click.
Question 16: Which of the following is NOT a valid locator strategy in Selenium? A) By.id B) By.name C) By.xpath D) All of these are valid Answer: D) All of these are valid Explanation: All listed locator strategies are valid: By.id, By.name, By.xpath, By.tagName, and By.cssSelector. Reference: SeU CSE Exam – Locator Strategies
Question 17: What is the difference between findElement() and findElements()? A) findElement() returns the first match; findElements() returns all matches
B) findElement() returns all matches; findElements() returns the first match C) Both return a list of elements D) Both return a single element Answer: A) findElement() returns the first match; findElements() returns all matches Explanation: findElement() returns the first matching WebElement or throws an exception if none are found, while findElements() returns a List of all matching elements. Reference: SeU CSE Exam – Locator Strategies
Question 18: How do you handle multiple windows in Selenium? A) driver.switchTo().window(windowHandle); B) driver.getWindowHandle(); C) driver.windowHandles();
Explanation: The driver.get() method navigates to the specified URL and blocks until the page load is complete. Reference: SeU CSE Exam – Navigation
Question 20: Which of the following is an example of a Fluent Wait? A) Thread.sleep(1000); B) WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10)); C) Wait wait = new FluentWait(driver) .withTimeout(Duration.ofSeconds(30)) .pollingEvery(Duration.ofSeconds(5)); D) driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10)); Answer: C) `Wait wait = new FluentWait(driver)
.withTimeout(Duration.ofSeconds(30)) .pollingEvery(Duration.ofSeconds(5));` Explanation: Fluent Wait allows you to define the maximum wait time, the polling interval, and which exceptions to ignore, providing the most control over synchronization. Reference: SeU CSE Exam – Synchronization
Question 21: What is the output of the following Java code?
System.out.println(5 + "5");