Challenge - 5 Problems
Edge Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediateWhat is the output of this Edge WebDriver configuration code?
Consider the following Python Selenium code snippet configuring Edge WebDriver. What will be printed when this code runs successfully?
Selenium Python
from selenium import webdriver from selenium.webdriver.edge.options import Options options = Options() options.use_chromium = True options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Edge(options=options) print(driver.capabilities['browserName']) driver.quit()
Attempts:
2 left
💡 Hint
Check the browserName capability for Edge when using Chromium-based EdgeDriver.
✗ Incorrect
The Edge WebDriver when configured with Chromium options reports the browserName as "edge" in capabilities.
❓ locator
intermediateWhich locator strategy is best for stable Edge WebDriver tests?
You want to locate a button with text "Submit" on a webpage using Edge WebDriver. Which locator is the most stable and recommended?
Attempts:
2 left
💡 Hint
IDs are unique and less likely to change compared to classes or text.
✗ Incorrect
Using 'id' is the most stable locator because IDs are unique and less prone to change, making tests more reliable.
❓ assertion
advancedWhich assertion correctly verifies Edge browser is running in headless mode?
Given an Edge WebDriver instance configured with headless mode, which assertion correctly checks this setting?
Selenium Python
from selenium import webdriver from selenium.webdriver.edge.options import Options options = Options() options.add_argument('--headless') driver = webdriver.Edge(options=options)
Attempts:
2 left
💡 Hint
Check the Edge-specific options in capabilities for the headless argument.
✗ Incorrect
The headless argument is stored in 'ms:edgeOptions' under 'args' in capabilities, so checking for '--headless' there is correct.
🔧 Debug
advancedWhy does this Edge WebDriver code raise a SessionNotCreatedException?
Review the code below. Why does it raise a SessionNotCreatedException when run?
Selenium Python
from selenium import webdriver from selenium.webdriver.edge.options import Options options = Options() options.use_chromium = False driver = webdriver.Edge(options=options) driver.quit()
Attempts:
2 left
💡 Hint
Check compatibility between EdgeDriver and browser versions regarding Chromium usage.
✗ Incorrect
Setting use_chromium to False tries to start legacy Edge, but modern EdgeDriver supports only Chromium-based Edge, causing SessionNotCreatedException.
❓ framework
expertHow to configure pytest to run tests only on Edge with headless mode?
You want to run Selenium tests using pytest only on Edge browser in headless mode. Which pytest fixture configuration is correct?
Selenium Python
import pytest from selenium import webdriver from selenium.webdriver.edge.options import Options @pytest.fixture def driver(): options = Options() options.add_argument('--headless') driver = webdriver.Edge(options=options) yield driver driver.quit()
Attempts:
2 left
💡 Hint
Headless mode requires adding the '--headless' argument to Edge options.
✗ Incorrect
Option D correctly adds '--headless' argument to Edge options and uses a pytest fixture to manage driver lifecycle.
