Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Selenium WebDriver module.
Selenium Python
from selenium import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'driver' instead of 'webdriver' causes import errors.
Importing 'selenium' alone does not provide browser control.
✗ Incorrect
The correct import is webdriver from the Selenium package to control browsers.
2fill in blank
mediumComplete the code to create a Chrome WebDriver instance.
Selenium Python
driver = webdriver.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'chrome' causes attribute errors.
Choosing a different browser name launches the wrong browser.
✗ Incorrect
To launch Chrome browser, use webdriver.Chrome().
3fill in blank
hardFix the error in the code to set up GeckoDriver for Firefox.
Selenium Python
driver = webdriver.[1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'firefox' causes attribute errors.
Trying to use 'Gecko' is invalid in Selenium WebDriver.
✗ Incorrect
The correct class name is Firefox with capital F to create a Firefox driver.
4fill in blank
hardFill in the blank to specify the path to ChromeDriver executable correctly.
Selenium Python
driver = webdriver.Chrome(executable_path=[1]) Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using backslash
\\ on Unix causes path errors.Omitting quotes around the path causes syntax errors.
✗ Incorrect
The path to the ChromeDriver executable is a string like "/usr/local/bin/chromedriver" on Unix systems.
5fill in blank
hardFill all three blanks to import WebDriver, create Firefox driver, and open a URL.
Selenium Python
from selenium import [1] driver = [2].Firefox() driver.[3]("https://example.com")
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'firefox' instead of 'webdriver' for driver creation.
Using 'open' instead of 'get' to open a URL.
✗ Incorrect
Import webdriver, create Firefox driver with webdriver.Firefox(), and open URL with driver.get().