0
0
Selenium Pythontesting~20 mins

Firefox configuration in Selenium Python - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Firefox 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 Firefox profile configuration code?
Consider the following Selenium Python code that sets a Firefox profile preference. What will be the value of the preference browser.startup.homepage after running this code?
Selenium Python
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

profile = FirefoxProfile()
profile.set_preference('browser.startup.homepage', 'https://example.com')
profile.update_preferences()

options = Options()
options.profile = profile

print(profile.default_preferences.get('browser.startup.homepage'))
Ahttps://example.com
BNone
C'' (empty string)
DRaises AttributeError
Attempts:
2 left
💡 Hint
Check how preferences are set and accessed in FirefoxProfile.
assertion
intermediate
1:30remaining
Which assertion correctly verifies Firefox runs in headless mode?
Given a Selenium Firefox WebDriver instance configured to run headless, which assertion correctly checks that the browser is running in headless mode?
Selenium Python
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options

options = Options()
options.headless = True

driver = Firefox(options=options)

# Which assertion below is correct?
Aassert driver.options.headless == False
Bassert driver.options.headless is None
Cassert driver.capabilities['headless'] == 'True'
Dassert driver.capabilities['moz:headless'] is True
Attempts:
2 left
💡 Hint
Check the capabilities dictionary for the 'moz:headless' key.
🔧 Debug
advanced
2:30remaining
Why does this Firefox WebDriver fail to start with a custom profile?
This Selenium Python code tries to start Firefox with a custom profile but raises an error. Identify the cause.
Selenium Python
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

profile = FirefoxProfile('/path/to/custom/profile')
options = Options()
options.profile = profile

driver = Firefox(options=options)
AThe profile path is invalid or inaccessible causing a FileNotFoundError
BUsing options.profile with FirefoxProfile path causes an error; should use FirefoxProfile directly in Firefox()
CFirefoxProfile cannot be passed to options.profile; must use options.set_preference instead
DMissing geckodriver executable in PATH causes failure
Attempts:
2 left
💡 Hint
Check if the profile path exists and is accessible.
framework
advanced
2:00remaining
How to configure Firefox to accept insecure certificates in Selenium Python?
You want Firefox WebDriver to accept insecure SSL certificates during tests. Which code snippet correctly configures this?
A
options = Options()
options.set_preference('security.insecure_field_warning.contextual.enabled', False)
driver = Firefox(options=options)
B
profile = FirefoxProfile()
profile.set_preference('acceptInsecureCerts', True)
driver = Firefox(firefox_profile=profile)
C
options = Options()
options.accept_insecure_certs = True
 driver = Firefox(options=options)
D
driver = Firefox()
driver.accept_insecure_certs = True
Attempts:
2 left
💡 Hint
Check the Options class for accepting insecure certs.
🧠 Conceptual
expert
1:30remaining
What is the effect of setting 'dom.webnotifications.enabled' to False in Firefox profile?
In Firefox profile preferences, what does setting dom.webnotifications.enabled to False do during automated testing?
ABlocks all JavaScript execution on the page
BDisables web push notifications, preventing pop-ups during tests
CEnables web notifications, allowing tests to receive alerts
DCauses Firefox to run in safe mode
Attempts:
2 left
💡 Hint
Think about how notifications affect test stability.