Bird
0
0

Consider this code snippet to handle CAPTCHA manually:

medium📝 Predict Output Q13 of 15
Selenium Python - Advanced Patterns
Consider this code snippet to handle CAPTCHA manually:
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Chrome()
driver.get('https://example.com/captcha')
time.sleep(60)  # wait for manual CAPTCHA solve
button = driver.find_element(By.ID, 'submit')
button.click()

What will happen if the CAPTCHA is not solved within 60 seconds?
AThe submit button will be clicked regardless of CAPTCHA status.
BThe test will fail because the CAPTCHA blocks the submit button.
CSelenium will automatically solve the CAPTCHA after 60 seconds.
DThe script will throw a syntax error.
Step-by-Step Solution
Solution:
  1. Step 1: Analyze the code flow

    The script waits 60 seconds for manual CAPTCHA solving, then tries to click the submit button.
  2. Step 2: Understand CAPTCHA effect

    If CAPTCHA is not solved, the submit button is usually disabled or blocked, so clicking won't succeed or may cause failure.
  3. Final Answer:

    The test will fail because the CAPTCHA blocks the submit button. -> Option B
  4. Quick Check:

    Unsolved CAPTCHA blocks submit = B [OK]
Quick Trick: Unsolved CAPTCHA blocks actions, causing test failure [OK]
Common Mistakes:
  • Assuming Selenium solves CAPTCHA automatically
  • Thinking submit button always clickable
  • Expecting syntax errors from this code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Selenium Python Quizzes