0
0
Selenium Pythontesting~10 mins

Prompt alert with text input 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 switch to the prompt alert.

Selenium Python
alert = driver.switch_to.[1]()
Drag options to blanks, or click blank then click option'
Aframe
Bprompt
Cwindow
Dalert
Attempts:
3 left
💡 Hint
Common Mistakes
Using driver.switch_to.prompt() which does not exist.
Trying to switch to frame or window instead of alert.
2fill in blank
medium

Complete the code to send text 'hello' to the prompt alert.

Selenium Python
alert.[1]('hello')
Drag options to blanks, or click blank then click option'
Asend_keys
Binput_text
Ctype
Dwrite
Attempts:
3 left
💡 Hint
Common Mistakes
Using alert.type() or alert.write() which are not valid methods.
Trying to assign text directly to alert.
3fill in blank
hard

Fix the error in the code to accept the prompt alert.

Selenium Python
alert.[1]()
Drag options to blanks, or click blank then click option'
Aok
Bconfirm
Caccept
Dsubmit
Attempts:
3 left
💡 Hint
Common Mistakes
Using alert.confirm() or alert.ok() which do not exist.
Trying to use alert.submit() which is for forms.
4fill in blank
hard

Fill both blanks to get the alert text and then dismiss the alert.

Selenium Python
text = alert.[1]
alert.[2]()
Drag options to blanks, or click blank then click option'
Atext
Bdismiss
Cget_text
Dclose
Attempts:
3 left
💡 Hint
Common Mistakes
Using alert.get_text() which is not a valid method.
Using alert.close() which does not dismiss alerts.
5fill in blank
hard

Fill all three blanks to handle a prompt alert: switch, send text, and accept.

Selenium Python
alert = driver.switch_to.[1]()
alert.[2]('test input')
alert.[3]()
Drag options to blanks, or click blank then click option'
Aalert
Bsend_keys
Caccept
Dprompt
Attempts:
3 left
💡 Hint
Common Mistakes
Using driver.switch_to.prompt() which is invalid.
Using alert.write() instead of send_keys.
Using alert.confirm() instead of accept().