Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Edge WebDriver from Selenium.
Selenium Python
from selenium.webdriver.edge import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Importing the wrong WebDriver class like Chrome or Firefox.
Using lowercase instead of the correct class name.
✗ Incorrect
The Edge WebDriver is imported from selenium.webdriver.edge as Edge.
2fill in blank
mediumComplete the code to create an Edge WebDriver instance with default options.
Selenium Python
driver = [1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong WebDriver class name.
Forgetting the parentheses to instantiate the driver.
✗ Incorrect
To create an Edge WebDriver instance, call Edge().
3fill in blank
hardFix the error in the code to set Edge options correctly.
Selenium Python
from selenium.webdriver.edge.options import EdgeOptions options = EdgeOptions() options.[1] = True
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using capitalized or incorrect attribute names.
Trying to call a method instead of setting an attribute.
✗ Incorrect
The correct attribute to enable headless mode is headless in lowercase.
4fill in blank
hardFill both blanks to add an argument to Edge options and create the driver with those options.
Selenium Python
options = EdgeOptions() options.add_argument([1]) driver = Edge(options=[2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the wrong variable to the driver constructor.
Using incorrect argument strings without quotes.
✗ Incorrect
Use "--headless" as the argument string and pass options to the Edge constructor.
5fill in blank
hardFill all three blanks to set Edge options for headless mode, disable GPU, and create the driver.
Selenium Python
options = EdgeOptions() options.add_argument([1]) options.add_argument([2]) driver = Edge([3]=options)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up variable names in the constructor.
Forgetting quotes around argument strings.
✗ Incorrect
Pass the two argument strings to add_argument and pass options to the Edge constructor.