0
0
Selenium Pythontesting~10 mins

Running Selenium in CI pipeline 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 import the Selenium WebDriver module.

Selenium Python
from selenium import [1]
Drag options to blanks, or click blank then click option'
Abrowser
Bdriver
Cselenium
Dwebdriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'driver' or 'browser' instead of 'webdriver' causes import errors.
2fill in blank
medium

Complete the code to create a Chrome WebDriver instance for running tests.

Selenium Python
driver = [1].Chrome()
Drag options to blanks, or click blank then click option'
Awebdriver
Bselenium
Cbrowser
Ddriver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'selenium.Chrome()' or 'driver.Chrome()' causes errors.
3fill in blank
hard

Fix the error in the code to run Chrome in headless mode in CI.

Selenium Python
options = webdriver.ChromeOptions()
options.add_argument([1])
driver = webdriver.Chrome(options=options)
Drag options to blanks, or click blank then click option'
A'--headless=true'
B'headless'
C'--headless'
D'headless=true'
Attempts:
3 left
💡 Hint
Common Mistakes
Missing dashes or adding '=true' causes Chrome to ignore headless mode.
4fill in blank
hard

Fill both blanks to add arguments for running Chrome in CI with no sandbox and headless.

Selenium Python
options = webdriver.ChromeOptions()
options.add_argument([1])
options.add_argument([2])
driver = webdriver.Chrome(options=options)
Drag options to blanks, or click blank then click option'
A'--no-sandbox'
B'--headless'
C'--disable-gpu'
D'--incognito'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--disable-gpu' or '--incognito' instead of required arguments.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering environment variables for CI setup.

Selenium Python
ci_env = [1]: [2] for [3] in env_vars if [3].startswith('CI_')
Drag options to blanks, or click blank then click option'
Akey
Benv_vars[key]
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or using undefined names causes errors.