0
0
Selenium Pythontesting~10 mins

Docker-based Grid 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 start a remote WebDriver session using Selenium Grid.

Selenium Python
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.[1]
)
Drag options to blanks, or click blank then click option'
ASAFARI
BFIREFOX
CEDGE
DCHROME
Attempts:
3 left
💡 Hint
Common Mistakes
Using a browser name that is not supported or misspelled.
Confusing the capability constants with lowercase strings.
2fill in blank
medium

Complete the code to specify the Selenium Grid hub URL correctly.

Selenium Python
hub_url = 'http://[1]:4444/wd/hub'
driver = webdriver.Remote(
    command_executor=hub_url,
    desired_capabilities=DesiredCapabilities.CHROME
)
Drag options to blanks, or click blank then click option'
A127.0.0.1
Blocalhost
Cselenium-hub
D192.168.1.100
Attempts:
3 left
💡 Hint
Common Mistakes
Using an IP address that does not match the hub's actual address.
Leaving the URL incomplete or missing the port.
3fill in blank
hard

Fix the error in the code to correctly import the Selenium WebDriver module for remote execution.

Selenium Python
from selenium import [1]
driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.CHROME
)
Drag options to blanks, or click blank then click option'
Aremote
Bwebdriver_remote
Cwebdriver
Dselenium
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to import a non-existent module like remote or webdriver_remote.
Importing the whole selenium package instead of the webdriver submodule.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that filters nodes with status 'ready' and extracts their names.

Selenium Python
ready_nodes = {node['name']: node for node in nodes if node[1]'status' == '[2]'}
Drag options to blanks, or click blank then click option'
A['
C.get(
Attempts:
3 left
💡 Hint
Common Mistakes
Using dot notation instead of square brackets for dictionary keys.
Forgetting quotes around the key name.
5fill in blank
hard

Fill all three blanks to create a test assertion that checks if the page title contains the word 'Dashboard'.

Selenium Python
assert '[1]' in driver.title, 'Page title does not contain [2]'
print('Test [3]')
Drag options to blanks, or click blank then click option'
ADashboard
Cpassed
Dfailed
Attempts:
3 left
💡 Hint
Common Mistakes
Using the wrong word in the assertion or print statement.
Mixing up the assertion message and the print output.