0
0
Selenium Pythontesting~20 mins

Edge configuration in Selenium Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Edge Configuration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What 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()
A"chrome"
B"edge"
C"firefox"
D"safari"
Attempts:
2 left
💡 Hint
Check the browserName capability for Edge when using Chromium-based EdgeDriver.
locator
intermediate
1:30remaining
Which 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?
Adriver.find_element('id', "submit")
Bdriver.find_element('css selector', "button.submit-btn")
Cdriver.find_element('xpath', "//button[text()='Submit']")
Ddriver.find_element('class name', "btn")
Attempts:
2 left
💡 Hint
IDs are unique and less likely to change compared to classes or text.
assertion
advanced
2:00remaining
Which 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)
Aassert '--headless' in driver.capabilities['ms:edgeOptions']['args']
Bassert 'headless' in driver.capabilities['browserName']
Cassert driver.capabilities['headless'] == True
Dassert driver.execute_script('return navigator.webdriver') == False
Attempts:
2 left
💡 Hint
Check the Edge-specific options in capabilities for the headless argument.
🔧 Debug
advanced
2:30remaining
Why 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()
ABecause the Edge browser is not installed on the system
BBecause Edge WebDriver does not support options parameter
CBecause use_chromium is set to False but the installed EdgeDriver only supports Chromium-based Edge
DBecause options object is missing required arguments for Edge
Attempts:
2 left
💡 Hint
Check compatibility between EdgeDriver and browser versions regarding Chromium usage.
framework
expert
3:00remaining
How 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()
A
@pytest.fixture
 def driver():
  options = Options()
  options.add_argument('--disable-gpu')
  driver = webdriver.Edge(options=options)
  yield driver
  driver.quit()
B
@pytest.fixture
 def driver():
  options = Options()
  options.use_chromium = False
  driver = webdriver.Edge(options=options)
  yield driver
  driver.quit()
C
@pytest.fixture
 def driver():
  driver = webdriver.Edge()
  yield driver
  driver.quit()
D
@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.