0
0
Selenium Pythontesting~10 mins

Grid architecture (hub and node) 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 Selenium Grid hub using the command line.

Selenium Python
java -jar selenium-server-[1].jar hub
Drag options to blanks, or click blank then click option'
Aserver
Bstandalone
Cgrid
Dnode
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'standalone' instead of 'server' in the jar file name.
Using 'node' which is for starting nodes, not the hub.
2fill in blank
medium

Complete the code to register a node to the Selenium Grid hub.

Selenium Python
java -jar selenium-server-[1].jar node --hub http://localhost:4444/grid/register
Drag options to blanks, or click blank then click option'
Astandalone
Bnode
Cgrid
Dserver
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'standalone' or 'node' as jar file name instead of 'server'.
Forgetting to specify the hub URL.
3fill in blank
hard

Fix the error in the Python code to create a remote WebDriver session on the Selenium Grid hub.

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=[1]
)
Drag options to blanks, or click blank then click option'
ADesiredCapabilities.chrome
BDesiredCapabilities.CHROME
CDesiredCapabilities.Firefox
DDesiredCapabilities.firefox
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase attribute names which do not exist.
Using Firefox capabilities when Chrome is intended.
4fill in blank
hard

Fill both blanks to create a dictionary of desired capabilities for Firefox with JavaScript enabled.

Selenium Python
capabilities = {
    'browserName': [1],
    'javascriptEnabled': [2]
}
Drag options to blanks, or click blank then click option'
A'firefox'
BTrue
CFalse
D'chrome'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'chrome' instead of 'firefox' for browserName.
Setting javascriptEnabled to False which disables scripts.
5fill in blank
hard

Fill all three blanks to create a Selenium Grid node configuration dictionary with max sessions 5, port 5555, and hub URL.

Selenium Python
node_config = {
    'maxSession': [1],
    'port': [2],
    'hub': '[3]'
}
Drag options to blanks, or click blank then click option'
A5
B5555
Chttp://localhost:4444/grid/register
D4444
Attempts:
3 left
💡 Hint
Common Mistakes
Using port 4444 which is the hub port, not node port.
Using incomplete or wrong hub URL.