Skip to content
CodeKruPro

The element is on screen but Selenium cannot find it

QuizMediumAsked in: Accenture, Capgemini, Cognizant, Infosys, TCS, Wipro

Earlier in the test you switched into an iframe. Now a find for the main page heading throws NoSuchElementException, though the heading is clearly on screen. What is the most likely cause?

  • The driver is still focused on the iframe, which cannot see the main document
  • The heading is hidden
  • The browser crashed
  • The locator must use XPath

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