0
0
Selenium Pythontesting~10 mins

Firefox configuration in Selenium Python - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to create a Firefox WebDriver instance.

Selenium Python
from selenium import webdriver

browser = webdriver.Firefox([1])
Drag options to blanks, or click blank then click option'
Aexecutable_path='geckodriver.exe'
Boptions=None
Cservice=None
Dfirefox_profile=None
Attempts:
3 left
💡 Hint
Common Mistakes
Using deprecated 'executable_path' parameter.
Passing 'options' without creating FirefoxOptions object.
2fill in blank
medium

Complete the code to set Firefox to run in headless mode.

Selenium Python
from selenium.webdriver.firefox.options import Options

options = Options()
options.[1] = True

browser = webdriver.Firefox(options=options)
Drag options to blanks, or click blank then click option'
Aheadless
Bset_headless
Cenable_headless
Drun_headless
Attempts:
3 left
💡 Hint
Common Mistakes
Using a method name instead of a property.
Misspelling the property name.
3fill in blank
hard

Fix the error in the code to set a custom Firefox profile path.

Selenium Python
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

profile = FirefoxProfile('[1]')
browser = webdriver.Firefox(firefox_profile=profile)
Drag options to blanks, or click blank then click option'
AC:\Users\User\AppData\Roaming\Mozilla\Firefox\Profiles\xyz.default
Bcustom/profile/path
Cprofile/path
D/path/to/custom/profile
Attempts:
3 left
💡 Hint
Common Mistakes
Using relative or incomplete paths.
Using single backslashes without escaping on Windows.
4fill in blank
hard

Fill both blanks to set a Firefox preference and start the browser with it.

Selenium Python
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

profile = FirefoxProfile()
profile.set_preference('[1]', [2])

browser = webdriver.Firefox(firefox_profile=profile)
Drag options to blanks, or click blank then click option'
Ajavascript.enabled
Bnetwork.proxy.type
CTrue
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect preference names.
Passing string 'True' instead of boolean True.
5fill in blank
hard

Fill all three blanks to create a Firefox WebDriver with headless mode and a custom profile path.

Selenium Python
from selenium import webdriver
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile

options = Options()
options.[1] = True
profile = FirefoxProfile('[2]')
browser = webdriver.Firefox(options=options, firefox_profile=profile, service=[3])
Drag options to blanks, or click blank then click option'
Aheadless
BC:\Users\User\AppData\Roaming\Mozilla\Firefox\Profiles\xyz.default
CNone
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect property names for headless mode.
Using relative or incomplete profile paths.
Passing incorrect service parameter values.