Bird
Raised Fist0
Selenium Pythontesting~20 mins

Selenium vs Cypress vs Playwright comparison in Selenium Python - Practice Questions

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Master of Selenium vs Cypress vs Playwright
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Key difference in browser support among Selenium, Cypress, and Playwright
Which testing tool supports testing across multiple browsers including Firefox, Chrome, and Safari natively?
ACypress supports only Chrome-family browsers natively.
BNone of these tools support Safari browser testing.
CSelenium supports only Chrome and Firefox but not Safari.
DPlaywright supports multiple browsers including Firefox, Chrome, and WebKit (Safari).
Attempts:
2 left
💡 Hint
Think about which tool uses browser engines directly for cross-browser testing.
❓ Predict Output
intermediate
2:00remaining
Output of Selenium Python code snippet for page title
What will be the output of this Selenium Python code snippet if the page title is 'Welcome Page'?
Selenium Python
from selenium import webdriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

options = Options()
options.add_argument('--headless')
service = Service('/path/to/chromedriver')
driver = webdriver.Chrome(service=service, options=options)
driver.get('https://example.com')
print(driver.title)
driver.quit()
AWelcome Page
Bhttps://example.com
CNone
DSyntaxError
Attempts:
2 left
💡 Hint
The print statement outputs the page title property.
❓ assertion
advanced
2:00remaining
Correct assertion to verify element visibility in Cypress
Which assertion correctly verifies that an element with id 'submit-btn' is visible in Cypress?
Selenium Python
cy.get('#submit-btn')
Acy.get('#submit-btn').should('be.visible')
Bcy.get('#submit-btn').assertVisible()
Ccy.get('#submit-btn').expect('visible')
Dcy.get('#submit-btn').checkVisible()
Attempts:
2 left
💡 Hint
Cypress uses 'should' for assertions.
🔧 Debug
advanced
2:00remaining
Identify the error in Playwright Python code snippet
What error will this Playwright Python code raise?
Selenium Python
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    page = browser.new_page()
    page.goto('https://example.com')
    print(page.title)
    browser.close()
ASyntaxError due to missing colon
BNo error, prints method object
CTimeoutError on page.goto
DAttributeError: 'Page' object has no attribute 'title'
Attempts:
2 left
💡 Hint
Check how to get page title in Playwright Python.
❓ framework
expert
3:00remaining
Choosing the best tool for fast, reliable end-to-end tests with automatic waiting
Which testing framework among Selenium, Cypress, and Playwright provides automatic waiting for elements and network calls, reducing flaky tests without explicit waits?
ANone of these frameworks provide automatic waiting features.
BSelenium requires explicit waits and does not have automatic waiting.
CCypress automatically waits for elements and network calls before actions.
DPlaywright requires manual waits for network calls but auto-waits for elements.
Attempts:
2 left
💡 Hint
Think about which tool is designed to reduce flaky tests with built-in waits.

Practice

(1/5)
1. Which testing tool is known for supporting multiple programming languages including Python and JavaScript, and offers broad browser support?
easy
A. Cypress
B. Playwright
C. Selenium
D. JUnit

Solution

  1. Step 1: Identify language support

    Selenium supports many languages like Python, Java, C#, etc., unlike Cypress which mainly supports JavaScript.
  2. Step 2: Check browser support

    Selenium supports many browsers including Chrome, Firefox, Safari, Edge, and more, making it broad in browser support.
  3. Final Answer:

    Selenium -> Option C
  4. Quick Check:

    Multi-language + broad browsers = Selenium [OK]
Hint: Multi-language and broad browser support points to Selenium [OK]
Common Mistakes:
  • Confusing Cypress as multi-language
  • Thinking Playwright supports more languages than Selenium
  • Choosing JUnit which is a Java testing framework
2. Which of the following is the correct way to start a Playwright browser session in Python?
easy
A. browser = playwright.chromium.launch()
B. browser = Playwright.start()
C. browser = playwright.startBrowser()
D. browser = Playwright.launchChromium()

Solution

  1. Step 1: Recall Playwright Python syntax

    Playwright uses the syntax playwright.chromium.launch() to start a Chromium browser session.
  2. Step 2: Check other options for correctness

    Options B, C, and D do not match the official Playwright Python API method names.
  3. Final Answer:

    browser = playwright.chromium.launch() -> Option A
  4. Quick Check:

    Correct Playwright launch syntax = browser = playwright.chromium.launch() [OK]
Hint: Playwright uses playwright.chromium.launch() in Python [OK]
Common Mistakes:
  • Using incorrect method names like startBrowser()
  • Confusing Playwright with Selenium syntax
  • Capitalizing Playwright incorrectly in code
3. Given the following code snippet using Cypress, what will be the output if the element with id #submit is not found?
cy.get('#submit').click()
medium
A. Test fails with an error that element was not found
B. Test passes silently without clicking
C. Test retries indefinitely until element appears
D. Test skips the click and logs a warning

Solution

  1. Step 1: Understand Cypress default behavior

    Cypress automatically retries commands for a default timeout but if the element is not found within that time, it throws an error.
  2. Step 2: Analyze the code effect

    Since cy.get('#submit').click() requires the element, failure to find it causes the test to fail with an error.
  3. Final Answer:

    Test fails with an error that element was not found -> Option A
  4. Quick Check:

    Cypress fails test if element missing [OK]
Hint: Cypress fails test if element not found after retries [OK]
Common Mistakes:
  • Thinking Cypress passes silently
  • Assuming infinite retries
  • Believing it logs warning but continues
4. You wrote this Selenium Python code but it throws an error:
driver = webdriver.Chrome()
driver.get('https://example.com')
element = driver.find_element_by_id('login')
element.click()

What is the likely cause and fix?
medium
A. click() method does not exist; use submit() instead
B. Method find_element_by_id is deprecated; use find_element(By.ID, 'login') instead
C. URL is incorrect; fix the URL string
D. Chrome driver is not installed; install it first

Solution

  1. Step 1: Identify deprecated method usage

    In recent Selenium versions, find_element_by_id is deprecated and replaced by find_element with By.ID locator.
  2. Step 2: Apply correct method usage

    Use from selenium.webdriver.common.by import By and then driver.find_element(By.ID, 'login') to fix the error.
  3. Final Answer:

    Method find_element_by_id is deprecated; use find_element(By.ID, 'login') instead -> Option B
  4. Quick Check:

    Use By.ID locator, not deprecated method [OK]
Hint: Use find_element(By.ID, ...) instead of deprecated find_element_by_id [OK]
Common Mistakes:
  • Ignoring deprecation warnings
  • Assuming click() method is missing
  • Blaming URL or driver installation incorrectly
5. You want to write a test that runs on Chromium, Firefox, and WebKit browsers using Playwright in Python. Which approach correctly achieves this multi-browser testing?
hard
A. Run tests only on Chromium; Playwright does not support Firefox or WebKit
B. Use Cypress since it supports all three browsers natively
C. Use Selenium only because Playwright supports one browser at a time
D. Loop over playwright.chromium, playwright.firefox, and playwright.webkit to launch each browser and run tests

Solution

  1. Step 1: Understand Playwright multi-browser support

    Playwright supports Chromium, Firefox, and WebKit browsers and allows launching each separately.
  2. Step 2: Implement multi-browser testing

    Looping over playwright.chromium, playwright.firefox, and playwright.webkit to launch browsers and run tests is the correct approach.
  3. Final Answer:

    Loop over playwright.chromium, playwright.firefox, and playwright.webkit to launch each browser and run tests -> Option D
  4. Quick Check:

    Playwright multi-browser testing = loop launch [OK]
Hint: Loop over Playwright browsers to test all three [OK]
Common Mistakes:
  • Thinking Playwright supports only one browser
  • Choosing Cypress for multi-browser Python tests
  • Assuming Selenium is the only multi-browser tool
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard