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. Jason Huggins
B. Tim Berners-Lee
C. Brendan Eich
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 RC
B. Selenium Grid
C. Selenium IDE
D. Selenium Server

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

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

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 Grid
D. Selenium WebDriver

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

Creating your First Selenium script Easy
A. WebPage object
B. WebElement object
C. WebDriver object
D. TestSuite 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. get()
C. launch()
D. visit()

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

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

9 What is the main purpose of a Selenium test?

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

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 browser changes color
B. The IDE closes automatically
C. The computer restarts
D. The test reports a pass

12 What is commonly required before installing Selenium for Java?

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

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

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

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

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

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

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

16 How does Selenium WebDriver commonly communicate with a browser?

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

17 What does AUT stand for in software testing?

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

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. Task Manager
C. Download Manager
D. Print Preview

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

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

20 Which WebDriver class is used to launch Mozilla Firefox?

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

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

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

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 represented support for the Java language
C. It referred to an antidote for mercury poisoning
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 Manager
B. Selenium IDE
C. Selenium WebDriver
D. Selenium Grid

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 Manager
C. Selenium WebElement
D. Selenium IDE

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

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

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.open(url); driver.readTitle(); driver.stop();
B. driver.navigate(url); driver.title(); driver.closeAll();
C. driver.start(url); driver.getTitle(); driver.exit();
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.clear();
B. driver.quit();
C. driver.dispose();
D. driver.stop();

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.close() inside the test setup
B. Place driver.get() in an @AfterEach method
C. Place driver.quit() in an @AfterEach method
D. Place driver.quit() after every assertion

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. Repeat the click until the message appears
B. Add a fixed delay before every test step
C. Wait explicitly for the message to become visible
D. Refresh the page before checking the message

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

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

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

Installing Selenium Medium
A. Declare selenium-java in pom.xml
B. Install Selenium as an Eclipse plugin
C. Copy WebDriver classes into src
D. Add browser binaries to 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 Manager
C. Selenium RC
D. Selenium Grid

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

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

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

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

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.xpath("//input")
C. By.tagName("input")
D. By.name("userEmail")

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.xpath("//button[3]")
B. By.tagName("button")
C. By.cssSelector("[data-testid='save-order']")
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 number of DOM matches for the selector
B. The order of requests in the Network panel
C. The screen coordinates of the selected element
D. The element's current background color

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. Run both browsers through one driver instance
B. Create ChromeDriver or FirefoxDriver conditionally
C. Use ChromeDriver and rename it for Firefox
D. Convert the test into a Selenium IDE project

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 browser homepage was configured in Eclipse
B. The AUT was added to the Eclipse workspace
C. Maven dependencies were downloaded and added to the build path
D. The Selenium IDE extension was installed in Chrome

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

Who developed Selenium? Hard
A. Paul Hammant created it at Netscape to automate Firefox, and it was later renamed Selenium Grid.
B. Jason Huggins created it at ThoughtWorks to test an internal web application, and it was later released as open source.
C. Shinya Kasatani created it at Apache to test Java applications, and it was later renamed Selenium RC.
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 Grid; Paul Hammant—Selenium Core; Simon Stewart—Selenium IDE; Shinya Kasatani—WebDriver
D. Jason Huggins—Selenium Core; Paul Hammant—Selenium RC; Simon Stewart—WebDriver; Shinya Kasatani—Selenium IDE

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 RC, Selenium WebDriver, Selenium IDE
B. Selenium WebDriver, Selenium Grid, Selenium IDE
C. Selenium IDE, Selenium WebDriver, Selenium Grid
D. Selenium Grid, Selenium IDE, Selenium WebDriver

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 test framework's assertion library and its compatibility with the browser profile
B. The AUT's JavaScript framework and its compatibility with the Grid event bus
C. The node's browser-driver management and its compatibility with the installed browser
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 distributes tests across nodes, while the framework records and replays browser interactions.
B. WebDriver compiles test classes, while the framework downloads browsers and configures executable paths.
C. WebDriver supplies assertions, while the framework translates commands into browser-specific protocol messages.
D. WebDriver controls browsers, while the framework supplies test lifecycle, assertions, grouping, and reporting support.

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 before a try block and invoke quit() in its finally block.
B. Create the driver inside a catch block and invoke close() before each assertion.
C. Create the driver as a static field and rely on JVM shutdown to close each session.
D. Create the driver in every page object and invoke quit() after each element lookup.

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. Wait explicitly until the button is present or clickable, then locate and click it.
B. Refresh repeatedly until the page source contains the button's visible label.
C. Set a fixed sleep longer than the slowest observed run, then reuse the old element.
D. Catch NoSuchElementException and treat the test as passed when the button is absent.

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. Establish the required session state in setup and terminate or reset it in teardown for every test.
B. Order the methods alphabetically so authentication always occurs before the dependent test.
C. Reuse one static driver and add assertions that identify which test changed the session.
D. Retry the failing method after the suite completes so the browser state can stabilize.

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. Disable browser cookies so authentication data cannot cross test boundaries.
B. Use one shared window handle and switch to it before every test command.
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. Copy only the WebDriver interface JAR to the CI agent and omit protocol-related libraries.
B. Install the Selenium IDE extension on the CI agent and export the tests as Java.
C. Declare the Selenium Java dependency in pom.xml and let Maven resolve transitive dependencies.
D. Commit the developer's Eclipse workspace metadata and preserve its absolute classpath entries.

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. Replace driver.get() with driver.navigate().to() because only navigation initializes the driver.
B. Add Selenium IDE to Eclipse because IDE performs driver discovery for Java bindings.
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 communicates through browser automation endpoints, whereas RC injected Selenium Core JavaScript through an intermediary server.
B. WebDriver injects JavaScript into every page, whereas RC communicates only through operating-system accessibility APIs.
C. WebDriver requires a proxy server for every command, whereas RC invokes each browser's native driver directly.
D. WebDriver runs solely inside the browser extension, whereas RC uses the W3C WebDriver protocol externally.

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

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 ID selector copied from the edit button during the latest inspection
B. An absolute XPath using the current row number and button position
C. A CSS selector matching the first button element anywhere in the table
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. Wait for all cookies to load, then use the same selector against the top-level document.
C. Locate the shadow host, obtain its shadow root, and search for #email within that root.
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. Open the frame's source URL in a second tab and reuse the original element reference.
B. Use JavaScript to rename the frame before locating the element in the main document.
C. Wait for the frame, switch into it, locate the element, and return to default content when finished.
D. Prefix the element selector with the frame's ID and search directly from the main document.

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. Create a driver factory that returns a configured WebDriver based on an external browser parameter.
B. Use ChromeOptions for both browsers because all capability names are interchangeable.
C. Start both browsers for every test and execute each command against the first responsive one.
D. Place ChromeDriver and FirefoxDriver commands alternately inside each test method.

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. Rewrite the AUT URL from HTTPS to HTTP inside every cross-browser test.
B. Use ChromeDriver to create Firefox sessions because Chrome already accepts the site.
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. Update the Maven project configuration and verify Eclipse is using a compatible installed JDK.
B. Remove the Maven nature and add each transitive dependency as an external class file.
C. Install Selenium IDE in Firefox and point Eclipse at the browser extension's installation folder.
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. Install another Eclipse workspace and move only the generated .class files into it.
B. Change the WebDriver implementation to RemoteWebDriver and retain the older compiler level.
C. Add the browser driver executable to the Java build path and lower warning severity.
D. Install the required JDK, register it in Eclipse, and align the project JRE and compiler level.