Selenium WebDriver Browser & Driver Configuration 2 — Questions and Answers
Question 1: Which class is used to run tests on Firefox in Selenium WebDriver?
- FirefoxDriver (Correct answer)
- MozillaDriver
- GeckoDriver
- FFDriver
Correct answer: FirefoxDriver
FirefoxDriver is the Selenium WebDriver implementation that communicates with Firefox via GeckoDriver.
Question 2: What is GeckoDriver?
- A proxy that translates WebDriver commands to Firefox's Marionette protocol (Correct answer)
- A Firefox plugin for automation
- A standalone testing framework for Firefox
- Mozilla's replacement for Selenium IDE
Correct answer: A proxy that translates WebDriver commands to Firefox's Marionette protocol
GeckoDriver is an executable that implements the WebDriver protocol and delegates commands to Firefox via Marionette.
Question 3: How do you set a page load timeout of 30 seconds in WebDriver?
- driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30)) (Correct answer)
- driver.setPageTimeout(30)
- driver.manage().timeouts().setPageLoad(30000)
- driver.pageTimeout(30, TimeUnit.SECONDS)
Correct answer: driver.manage().timeouts().pageLoadTimeout(Duration.ofSeconds(30))
pageLoadTimeout() sets how long WebDriver waits for a page to fully load before throwing a TimeoutException.
Question 4: Which DesiredCapabilities setting accepts SSL certificates in older WebDriver versions?
- acceptInsecureCerts (Correct answer)
- ignoreSslErrors
- allowSSL
- disableCertCheck
Correct answer: acceptInsecureCerts
Setting acceptInsecureCerts to true instructs WebDriver to ignore SSL certificate errors when loading pages.
Question 5: What method sets the browser window to a specific size in WebDriver?
- driver.manage().window().setSize(new Dimension(width, height)) (Correct answer)
- driver.manage().window().resize(width, height)
- driver.setWindowSize(width, height)
- driver.manage().setViewport(width, height)
Correct answer: driver.manage().window().setSize(new Dimension(width, height))
setSize() on the Window object accepts a Dimension instance to resize the browser window.
Question 6: Which driver implementation is used for Microsoft Edge in Selenium 4?
- EdgeDriver (Correct answer)
- ChromiumEdgeDriver
- MicrosoftEdgeDriver
- EdgeChromiumDriver
Correct answer: EdgeDriver
Selenium 4 uses EdgeDriver backed by the msedgedriver executable for the Chromium-based Edge browser.
Which class is used to run tests on Firefox in Selenium WebDriver?