0
0
Selenium Pythontesting~10 mins

Selenium components (WebDriver, Grid, IDE) 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 new Chrome WebDriver instance.

Selenium Python
from selenium import webdriver

driver = webdriver.[1]()
Drag options to blanks, or click blank then click option'
AEdge
BFirefox
CSafari
DChrome
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firefox or Edge WebDriver when the question asks for Chrome.
Forgetting parentheses after the WebDriver name.
2fill in blank
medium

Complete the code to open the URL 'https://example.com' using the WebDriver.

Selenium Python
driver = webdriver.Chrome()
driver.[1]('https://example.com')
Drag options to blanks, or click blank then click option'
Avisit
Bget
Cnavigate
Dopen
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like open or visit.
Confusing navigate with Selenium WebDriver methods.
3fill in blank
hard

Fix the error in the code to correctly start a Selenium Grid remote WebDriver session.

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

remote_driver = webdriver.Remote(
    command_executor='http://localhost:4444/wd/hub',
    desired_capabilities=DesiredCapabilities.[1]
)
Drag options to blanks, or click blank then click option'
AChrome
Bchrome
CCHROME
DFirefox
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase or capitalized strings instead of the constant.
Using DesiredCapabilities.Chrome which does not exist.
4fill in blank
hard

Fill both blanks to create a Selenium IDE test command that clicks a button with id 'submitBtn'.

Selenium Python
commands = [
    {'command': '[1]', 'target': 'id=submitBtn', 'value': ''}
]
Drag options to blanks, or click blank then click option'
Aclick
Bopen
Ctype
Dselect
Attempts:
3 left
💡 Hint
Common Mistakes
Using open which is for opening URLs.
Using type which is for entering text.
5fill in blank
hard

Fill all three blanks to create a Selenium WebDriver script that opens a page, finds an element by name, and sends keys.

Selenium Python
driver = webdriver.Chrome()
driver.[1]('https://example.com')
element = driver.find_element_by_[2]('username')
element.[3]('testuser')
Drag options to blanks, or click blank then click option'
Aget
Bname
Csend_keys
Dclick
Attempts:
3 left
💡 Hint
Common Mistakes
Using click instead of send_keys to enter text.
Using wrong locator like id when asked for name.