Skip to content
CodeKruPro

A command runs while an alert is open (Java)

QuizMedium-HardJava onlyAsked in: TCS

An alert is open and the test calls driver.getTitle() without switching to it. With default settings in Chrome, what happens?

  • UnhandledAlertException is thrown and the alert is dismissed
  • The title is returned and the alert stays open
  • NoAlertPresentException is thrown
  • The test hangs until the alert is closed by hand

This question is part of Pro+

Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.

See Pro+

Already have Pro+? Sign in