Unit 1: Introduction to Selenium - Practice Quiz

CSE377 — Web Automation Testing 60 Questions
0 Correct 0 Wrong 60 Left
0/60

1 Who originally developed Selenium?

Who developed Selenium? Easy
A. Brendan Eich
B. Jason Huggins
C. Tim Berners-Lee
D. James Gosling

2 In which year was the first version of Selenium created?

Who developed Selenium? Easy
A. 1999
B. 2004
C. 2001
D. 2010

3 Which Selenium component is mainly used to create browser automation scripts without writing much code?

Selenium Components Easy
A. Selenium Grid
B. Selenium IDE
C. Selenium Server
D. Selenium RC

4 Which Selenium component provides programming language APIs for browser automation?

Selenium Components Easy
A. Selenium IDE
B. Selenium WebDriver
C. Selenium Grid
D. Selenium Recorder

5 Which Selenium component is used to run tests on multiple machines and browsers?

Selenium Components Easy
A. Selenium IDE
B. Selenium RC
C. Selenium WebDriver
D. Selenium Grid

6 Which object is commonly created first to control a browser using Selenium WebDriver?

Creating your First Selenium script Easy
A. WebElement object
B. WebPage object
C. TestSuite object
D. WebDriver object

7 Which WebDriver method is used to open a web page by specifying its URL?

Creating your First Selenium script Easy
A. open()
B. visit()
C. get()
D. launch()

8 Which method is commonly used to close the current browser window in Selenium?

Creating your First Selenium script Easy
A. end()
B. stop()
C. exit()
D. close()

9 What is the main purpose of a Selenium test?

Creating and Running Tests Easy
A. To design database tables
B. To edit image files
C. To automate browser actions
D. To compile operating systems

10 What does an assertion in a test generally do?

Creating and Running Tests Easy
A. Creates a project
B. Downloads a driver
C. Checks an expected result
D. Starts the browser

11 What usually indicates that a Selenium test has completed successfully?

Creating and Running Tests Easy
A. The test reports a pass
B. The IDE closes automatically
C. The browser changes color
D. The computer restarts

12 What is commonly required before installing Selenium for Java?

Installing Selenium Easy
A. A video editing tool
B. A graphics driver
C. A database server
D. A Java Development Kit

13 What must a Selenium project include to use WebDriver classes?

Installing Selenium Easy
A. Operating system patches
B. Image filters
C. Selenium libraries
D. Audio libraries

14 What is the purpose of a browser driver such as ChromeDriver?

Installing Selenium Easy
A. To connect Selenium with a browser
B. To manage email accounts
C. To store test screenshots
D. To write HTML pages

15 Which Selenium tool is the newer and generally preferred alternative to Selenium RC?

Comparison with Selenium RC Easy
A. Selenium Builder
B. Selenium IDE
C. Selenium WebDriver
D. Selenium Recorder

16 How does Selenium WebDriver commonly communicate with a browser?

Comparison with Selenium RC Easy
A. Through browser-specific drivers
B. Through email messages
C. Through manual keyboard actions
D. Through spreadsheet formulas

17 What does AUT stand for in software testing?

Launching AUT and Inspecting properties of Elements Easy
A. Automated Unit Tracker
B. Application User Template
C. Automation Utility Tool
D. Application Under Test

18 Which browser feature is commonly used to inspect an element's HTML properties?

Launching AUT and Inspecting properties of Elements Easy
A. Developer Tools
B. Download Manager
C. Print Preview
D. Task Manager

19 Which WebDriver class is used to launch Google Chrome in a Java Selenium script?

Launching AUT in Firefox and Chrome Easy
A. SafariDriver
B. EdgeDriver
C. ChromeDriver
D. FirefoxDriver

20 Which WebDriver class is used to launch Mozilla Firefox?

Launching AUT in Firefox and Chrome Easy
A. OperaDriver
B. ChromeDriver
C. InternetDriver
D. FirefoxDriver

21 A project team is documenting Selenium's origins. Which statement should be included in the document?

Who developed Selenium? Medium
A. Jason Huggins developed Selenium at ThoughtWorks
B. Simon Stewart developed Selenium at Microsoft
C. Brendan Eich developed Selenium at Netscape
D. James Gosling developed Selenium at Sun Microsystems

22 Why was the original Selenium tool given a name associated with a chemical element?

Who developed Selenium? Medium
A. It identified a ThoughtWorks testing framework
B. It referred to an antidote for mercury poisoning
C. It represented support for the Java language
D. It described a browser rendering mechanism

23 A tester wants to record browser interactions quickly and export them as an initial automated test. Which Selenium component is most suitable?

Selenium Components Medium
A. Selenium Grid
B. Selenium IDE
C. Selenium Manager
D. Selenium WebDriver

24 A test suite must run simultaneously on different browser and operating-system combinations. Which Selenium component directly supports this requirement?

Selenium Components Medium
A. Selenium Grid
B. Selenium IDE
C. Selenium WebElement
D. Selenium Manager

25 Which Selenium component provides a programming interface for controlling browsers through browser-specific automation mechanisms?

Selenium Components Medium
A. Selenium Grid
B. Selenium Server
C. Selenium IDE
D. Selenium WebDriver

26 In a Java Selenium script, which sequence correctly opens a page, reads its title, and closes the entire browser session?

Creating your First Selenium script Medium
A. driver.start(url); driver.getTitle(); driver.exit();
B. driver.open(url); driver.readTitle(); driver.stop();
C. driver.navigate(url); driver.title(); driver.closeAll();
D. driver.get(url); driver.getTitle(); driver.quit();

27 A first Selenium test creates WebDriver driver = new ChromeDriver(); but never releases it. Which statement should normally be placed in test cleanup?

Creating your First Selenium script Medium
A. driver.stop();
B. driver.quit();
C. driver.clear();
D. driver.dispose();

28 A JUnit test opens a browser successfully but leaves it running when an assertion fails. Which design best prevents this problem?

Creating and Running Tests Medium
A. Place driver.quit() after every assertion
B. Place driver.quit() in an @AfterEach method
C. Place driver.close() inside the test setup
D. Place driver.get() in an @AfterEach method

29 A login test clicks Submit and immediately checks a message that appears after an asynchronous request. The test fails intermittently. What is the most appropriate improvement?

Creating and Running Tests Medium
A. Add a fixed delay before every test step
B. Wait explicitly for the message to become visible
C. Refresh the page before checking the message
D. Repeat the click until the message appears

30 A test method performs an action but contains no assertion. What is the main consequence?

Creating and Running Tests Medium
A. It always fails when the action completes
B. It cannot launch a supported web browser
C. It cannot locate elements on the page
D. It may pass without verifying expected behavior

31 A Java project uses Maven. What is the most maintainable way to add Selenium WebDriver libraries?

Installing Selenium Medium
A. Install Selenium as an Eclipse plugin
B. Add browser binaries to pom.xml
C. Copy WebDriver classes into src
D. Declare selenium-java in pom.xml

32 A recent Selenium 4 Java project creates new ChromeDriver() without configuring a driver executable path, and the correct driver is obtained automatically. Which feature most likely handled this?

Installing Selenium Medium
A. Selenium IDE
B. Selenium RC
C. Selenium Grid
D. Selenium Manager

33 A legacy Selenium RC suite is being migrated to WebDriver. Which architectural change should the team expect?

Comparison with Selenium RC Medium
A. Tests must be recorded through a browser extension
B. Tests must execute only on a Grid hub
C. Commands require JavaScript injection through an RC server
D. Commands interact through browser automation interfaces

34 Why does WebDriver generally handle browser dialogs and native browser controls better than Selenium RC?

Comparison with Selenium RC Medium
A. WebDriver executes all commands inside the page JavaScript
B. WebDriver converts every dialog into an HTML element
C. WebDriver disables browser security during test execution
D. WebDriver communicates through browser automation capabilities

35 An AUT contains <input id="email" name="userEmail" type="email">. If the id is unique and stable, which locator is the clearest choice?

Launching AUT and Inspecting properties of Elements Medium
A. By.id("email")
B. By.name("userEmail")
C. By.tagName("input")
D. By.xpath("//input")

36 A button receives a different generated id after every deployment but always has data-testid="save-order". Which locator is likely to be most stable?

Launching AUT and Inspecting properties of Elements Medium
A. By.cssSelector("[data-testid='save-order']")
B. By.tagName("button")
C. By.xpath("//button[3]")
D. By.id("generated-save-button")

37 While inspecting an element in browser developer tools, which property is most useful for determining whether a CSS locator will uniquely identify it?

Launching AUT and Inspecting properties of Elements Medium
A. The order of requests in the Network panel
B. The number of DOM matches for the selector
C. The element's current background color
D. The screen coordinates of the selected element

38 A test framework must run the same scenario in Chrome or Firefox based on configuration. Which implementation is most appropriate?

Launching AUT in Firefox and Chrome Medium
A. Convert the test into a Selenium IDE project
B. Use ChromeDriver and rename it for Firefox
C. Create ChromeDriver or FirefoxDriver conditionally
D. Run both browsers through one driver instance

39 Chrome opens the AUT correctly, but Firefox reports a certificate warning in a test environment using a self-signed certificate. What is the targeted Selenium configuration?

Launching AUT in Firefox and Chrome Medium
A. Disable JavaScript in Firefox preferences
B. Enable insecure certificates in Firefox options
C. Replace get() with navigate().to()
D. Set Chrome options on the Firefox driver

40 After importing a Maven Selenium project into Eclipse, imports such as org.openqa.selenium.WebDriver remain unresolved. What should be checked first?

Downloading and Configuring latest Eclipse IDE Medium
A. The Selenium IDE extension was installed in Chrome
B. Maven dependencies were downloaded and added to the build path
C. The AUT was added to the Eclipse workspace
D. The browser homepage was configured in Eclipse

41 Which account most accurately describes Selenium's origin and early evolution?

Who developed Selenium? Hard
A. Shinya Kasatani created it at Apache to test Java applications, and it was later renamed Selenium RC.
B. Jason Huggins created it at ThoughtWorks to test an internal web application, and it was later released as open source.
C. Paul Hammant created it at Netscape to automate Firefox, and it was later renamed Selenium Grid.
D. Simon Stewart created it at Google to replace WebDriver, and it was later transferred to ThoughtWorks.

42 Which contributor-to-component mapping is historically accurate?

Who developed Selenium? Hard
A. Jason Huggins—Selenium IDE; Paul Hammant—WebDriver; Simon Stewart—Selenium RC; Shinya Kasatani—Selenium Core
B. Jason Huggins—WebDriver; Paul Hammant—Selenium Grid; Simon Stewart—Selenium Core; Shinya Kasatani—Selenium RC
C. Jason Huggins—Selenium Core; Paul Hammant—Selenium RC; Simon Stewart—WebDriver; Shinya Kasatani—Selenium IDE
D. Jason Huggins—Selenium Grid; Paul Hammant—Selenium Core; Simon Stewart—Selenium IDE; Shinya Kasatani—WebDriver

43 A team needs authoring by recording browser actions, standards-based programmatic automation, and parallel execution across remote machines. Which component sequence best matches those needs?

Selenium Components Hard
A. Selenium Grid, Selenium IDE, Selenium WebDriver
B. Selenium RC, Selenium WebDriver, Selenium IDE
C. Selenium IDE, Selenium WebDriver, Selenium Grid
D. Selenium WebDriver, Selenium Grid, Selenium IDE

44 A Grid node has Chrome installed, but every requested Chrome session fails before navigation begins. Local Chrome tests on the same machine work. Which missing or mismatched element is the most relevant first investigation?

Selenium Components Hard
A. The node's browser-driver management and its compatibility with the installed browser
B. The test framework's assertion library and its compatibility with the browser profile
C. The AUT's JavaScript framework and its compatibility with the Grid event bus
D. The hub's Selenium IDE extension and its compatibility with the recorded project

45 Which statement correctly separates Selenium WebDriver from a test framework such as JUnit or TestNG?

Selenium Components Hard
A. WebDriver compiles test classes, while the framework downloads browsers and configures executable paths.
B. WebDriver controls browsers, while the framework supplies test lifecycle, assertions, grouping, and reporting support.
C. WebDriver distributes tests across nodes, while the framework records and replays browser interactions.
D. WebDriver supplies assertions, while the framework translates commands into browser-specific protocol messages.

46 A Java script executes driver.get(url), finds an element, and clicks it. If element lookup throws an exception, driver.quit() is skipped and browser processes accumulate. Which structure most directly guarantees cleanup?

Creating your First Selenium script Hard
A. Create the driver inside a catch block and invoke close() before each assertion.
B. Create the driver as a static field and rely on JVM shutdown to close each session.
C. Create the driver in every page object and invoke quit() after each element lookup.
D. Create the driver before a try block and invoke quit() in its finally block.

47 A first script clicks a button immediately after navigation. It passes locally but intermittently raises NoSuchElementException in CI because the button is inserted asynchronously. What is the most targeted correction?

Creating your First Selenium script Hard
A. Set a fixed sleep longer than the slowest observed run, then reuse the old element.
B. Catch NoSuchElementException and treat the test as passed when the button is absent.
C. Wait explicitly until the button is present or clickable, then locate and click it.
D. Refresh repeatedly until the page source contains the button's visible label.

48 A JUnit test passes when run alone but fails when the entire class runs because another test leaves the user authenticated. Which redesign best restores test isolation?

Creating and Running Tests Hard
A. Reuse one static driver and add assertions that identify which test changed the session.
B. Establish the required session state in setup and terminate or reset it in teardown for every test.
C. Retry the failing method after the suite completes so the browser state can stabilize.
D. Order the methods alphabetically so authentication always occurs before the dependent test.

49 Four tests are executed in parallel using one shared static WebDriver. Failures show navigation and element actions occurring in the wrong test's window. Which change addresses the underlying concurrency defect?

Creating and Running Tests Hard
A. Use one shared window handle and switch to it before every test command.
B. Disable browser cookies so authentication data cannot cross test boundaries.
C. Provide each parallel test thread with an independent WebDriver session.
D. Add an implicit wait so commands remain queued until each page is ready.

50 A Maven-based Java project compiles in Eclipse but fails on a clean CI agent because Selenium JARs were manually added from a developer's local directory. What is the most reproducible installation fix?

Installing Selenium Hard
A. Declare the Selenium Java dependency in pom.xml and let Maven resolve transitive dependencies.
B. Commit the developer's Eclipse workspace metadata and preserve its absolute classpath entries.
C. Install the Selenium IDE extension on the CI agent and export the tests as Java.
D. Copy only the WebDriver interface JAR to the CI agent and omit protocol-related libraries.

51 With Selenium Manager available in a current Selenium installation, a new Java test still fails with NoSuchDriverException. Which diagnosis is most appropriate before manually setting a driver path?

Installing Selenium Hard
A. Add Selenium IDE to Eclipse because IDE performs driver discovery for Java bindings.
B. Replace driver.get() with driver.navigate().to() because only navigation initializes the driver.
C. Install Selenium RC because WebDriver cannot discover executables without an RC server.
D. Check Selenium version, browser installation, network or cache access, permissions, and the exception's resolution details.

52 Why did WebDriver generally provide a more browser-native automation model than Selenium RC?

Comparison with Selenium RC Hard
A. WebDriver requires a proxy server for every command, whereas RC invokes each browser's native driver directly.
B. WebDriver runs solely inside the browser extension, whereas RC uses the W3C WebDriver protocol externally.
C. WebDriver injects JavaScript into every page, whereas RC communicates only through operating-system accessibility APIs.
D. WebDriver communicates through browser automation endpoints, whereas RC injected Selenium Core JavaScript through an intermediary server.

53 A legacy RC suite could interact with content only after configuring a proxy and starting a separate Selenium server. When migrating ordinary local tests to modern WebDriver, which architectural change is expected?

Comparison with Selenium RC Hard
A. Tests convert all browser actions to HTTP assertions because WebDriver cannot manipulate page elements.
B. Tests embed Selenium Core into every AUT page and retain the proxy to satisfy same-origin restrictions.
C. Tests execute exclusively through Selenium Grid because local WebDriver sessions are not supported.
D. Tests create WebDriver sessions through browser-specific automation endpoints without the RC JavaScript-injection server.

54 Inspection shows five rows whose edit buttons all have generated IDs that change on every load, but each row has a stable data-user-id. Which locator is most resilient for editing user 42?

Launching AUT and Inspecting properties of Elements Hard
A. An absolute XPath using the current row number and button position
B. A CSS selector matching the first button element anywhere in the table
C. An ID selector copied from the edit button during the latest inspection
D. A CSS selector scoped to [data-user-id='42'] and its edit button

55 Developer Tools shows the target input inside an open shadow root. driver.findElement(By.cssSelector("#email")) from the document root fails. What is the correct conceptual approach?

Launching AUT and Inspecting properties of Elements Hard
A. Convert the selector to an absolute XPath because XPath automatically crosses shadow boundaries.
B. Locate the shadow host, obtain its shadow root, and search for #email within that root.
C. Wait for all cookies to load, then use the same selector against the top-level document.
D. Switch to the shadow root with switchTo().frame() and search from the document root.

56 An inspected element is inside an iframe. Its CSS selector is unique within that frame, but the test cannot find it from the main page. Which sequence is required?

Launching AUT and Inspecting properties of Elements Hard
A. Use JavaScript to rename the frame before locating the element in the main document.
B. Prefix the element selector with the frame's ID and search directly from the main document.
C. Wait for the frame, switch into it, locate the element, and return to default content when finished.
D. Open the frame's source URL in a second tab and reuse the original element reference.

57 The same test must launch Firefox and Chrome using browser-specific options while keeping the test workflow unchanged. Which design best supports this requirement?

Launching AUT in Firefox and Chrome Hard
A. Use ChromeOptions for both browsers because all capability names are interchangeable.
B. Place ChromeDriver and FirefoxDriver commands alternately inside each test method.
C. Start both browsers for every test and execute each command against the first responsive one.
D. Create a driver factory that returns a configured WebDriver based on an external browser parameter.

58 Chrome opens the AUT successfully, but Firefox reports a certificate warning for the same internal HTTPS environment. The certificate is intentionally trusted only for test execution. Which configuration is most appropriate?

Launching AUT in Firefox and Chrome Hard
A. Use ChromeDriver to create Firefox sessions because Chrome already accepts the site.
B. Rewrite the AUT URL from HTTPS to HTTP inside every cross-browser test.
C. Disable all Firefox security preferences globally in the developer's default profile.
D. Set the accept-insecure-certificates capability for the Firefox test session.

59 After importing a Maven Selenium project into the latest Eclipse IDE, Java imports remain unresolved even though pom.xml is correct and mvn test succeeds in a terminal. What is the most appropriate Eclipse-side action?

Downloading and Configuring latest Eclipse IDE Hard
A. Remove the Maven nature and add each transitive dependency as an external class file.
B. Install Selenium IDE in Firefox and point Eclipse at the browser extension's installation folder.
C. Update the Maven project configuration and verify Eclipse is using a compatible installed JDK.
D. Convert the project to a plain folder and manually copy dependencies into the source directory.

60 Eclipse launches with one JRE, but the Selenium project targets a newer Java release and reports a compiler-compliance mismatch. Which configuration resolves the cause most directly?

Downloading and Configuring latest Eclipse IDE Hard
A. Add the browser driver executable to the Java build path and lower warning severity.
B. Change the WebDriver implementation to RemoteWebDriver and retain the older compiler level.
C. Install the required JDK, register it in Eclipse, and align the project JRE and compiler level.
D. Install another Eclipse workspace and move only the generated .class files into it.