0
0
Selenium Pythontesting~10 mins

Chrome 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 Chrome WebDriver instance.

Selenium Python
from selenium import webdriver
options = webdriver.ChromeOptions()
driver = webdriver.Chrome(options=[1])
Drag options to blanks, or click blank then click option'
Aoptions
Bwebdriver
Cdriver
DChromeOptions
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the class name instead of the options instance.
Passing the driver variable to itself.
Not passing any options at all.
2fill in blank
medium

Complete the code to add the headless argument to Chrome options.

Selenium Python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('[1]')
Drag options to blanks, or click blank then click option'
A--disable-gpu
B--incognito
C--start-maximized
D--headless
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--disable-gpu' which disables GPU but does not make it headless.
Using '--start-maximized' which opens a window maximized.
Using '--incognito' which opens private browsing mode.
3fill in blank
hard

Fix the error in setting the window size in Chrome options.

Selenium Python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('[1]')
Drag options to blanks, or click blank then click option'
A--window-size 1920x1080
B--window-size=1920x1080
C--window-size=1920,1080
D--window-size 1920,1080
Attempts:
3 left
💡 Hint
Common Mistakes
Using an 'x' instead of ',' to separate width and height.
Adding spaces between the argument and value.
Using an equal sign with spaces.
4fill in blank
hard

Fill both blanks to create a Chrome driver with headless mode and disable GPU.

Selenium Python
from selenium import webdriver
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--headless
B--disable-gpu
C--incognito
D--start-maximized
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--incognito' or '--start-maximized' which do not relate to headless mode.
Forgetting to disable GPU when running headless on some systems.
5fill in blank
hard

Fill all three blanks to create a Chrome driver with a custom user agent, headless mode, and window size 1280x720.

Selenium Python
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument('[1]')
options.add_argument('[2]')
options.add_argument('[3]')
driver = webdriver.Chrome(options=options)
Drag options to blanks, or click blank then click option'
A--user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64)
B--headless
C--window-size=1280,720
D--disable-extensions
Attempts:
3 left
💡 Hint
Common Mistakes
Using '--disable-extensions' instead of user agent or window size.
Incorrect format for window size argument.
Missing the headless argument.