0
0
Selenium Pythontesting~10 mins

Browser console log capture 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 import the Selenium WebDriver module.

Selenium Python
from selenium import [1]
Drag options to blanks, or click blank then click option'
Arequests
Bwebdriver
Cunittest
Dtime
Attempts:
3 left
💡 Hint
Common Mistakes
Importing unrelated modules like requests or unittest instead of webdriver.
2fill in blank
medium

Complete the code to create a Chrome WebDriver instance.

Selenium Python
driver = webdriver.[1]()
Drag options to blanks, or click blank then click option'
AFirefox
BEdge
CChrome
DSafari
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firefox or Safari when Chrome is required.
3fill in blank
hard

Fix the error in the code to get browser console logs.

Selenium Python
logs = driver.get_log('[1]')
Drag options to blanks, or click blank then click option'
Abrowser
Bclient
Cdriver
Dperformance
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'performance' or 'driver' instead of 'browser' as log type.
4fill in blank
hard

Fill both blanks to filter console logs for errors only.

Selenium Python
error_logs = [log for log in logs if log['[1]'] == '[2]']
Drag options to blanks, or click blank then click option'
Alevel
Bmessage
CSEVERE
Dwarning
Attempts:
3 left
💡 Hint
Common Mistakes
Filtering by 'message' key or using 'warning' instead of 'SEVERE'.
5fill in blank
hard

Fill all three blanks to print error messages from console logs.

Selenium Python
for log in error_logs:
    print(log['[1]'])  # Print the [2] of the log

# This helps to see the [3] details
Drag options to blanks, or click blank then click option'
Amessage
Btext
Cerror
Dcontent
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'error' or 'text' as keys incorrectly, or printing wrong log parts.