100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Testing

Handling Dropdowns, Frames, and Popups

Learn how to interact with native and custom dropdowns, work inside iframes, and manage new tabs, popup windows, and native browser dialogs in Playwright.

Locators & ActionsAdvanced9 min readJul 10, 2026
Analogies

Native Select Dropdowns vs Custom Dropdown Widgets

selectOption() works directly against a real <select> element by setting its value programmatically, without needing to simulate opening a dropdown UI at all. Many modern web apps, however, build their own dropdown widgets from styled <div> and <ul> elements — libraries like React-select or MUI Autocomplete render something that looks identical to a native select but has no underlying <select> tag. selectOption() simply does not work on these; you must interact with them exactly as a real user would, clicking the trigger element to open the panel, waiting for the option list to render, and then clicking the specific option by its role and text.

🏏

Cricket analogy: selectOption() works directly on a native <select>, like a scorer flipping a physical toggle switch on the scoreboard to change the format shown — but a custom div-based dropdown needs an actual click to open the panel and another click on the visible option, like a manual scoreboard operator physically swapping panel cards.

javascript
// Native <select> - direct, no UI simulation needed
await page.getByLabel('Country').selectOption('IN');
await page.getByLabel('Country').selectOption({ label: 'India' });

// Custom div-based dropdown (e.g. React-select) - must click through
await page.getByRole('combobox', { name: 'Country' }).click();
await page.getByRole('option', { name: 'India' }).click();

Working with iframes

page.frameLocator('iframe.payment-widget').getByLabel('Card number') scopes every subsequent locator to inside that iframe's own separate document. This is necessary because a plain page.locator() operates only on the main page's DOM and has no visibility into an iframe's content at all — the two documents are entirely isolated from each other in the browser's own model, not just in Playwright's API. When an iframe contains another nested iframe, you chain frameLocator() calls, each one stepping one level deeper: page.frameLocator('#outer').frameLocator('#inner').getByRole(...).

🏏

Cricket analogy: page.frameLocator() is like a commentary team switching to a separate broadcast feed from the boundary-rope camera crew, which operates its own independent production booth — a regular page.locator() can't see inside that separate feed at all, and nested iframes require chaining frameLocator calls.

Payment widgets like Stripe Elements are deliberately rendered inside an iframe for PCI-DSS compliance, isolating raw card data from the host page's JavaScript. Testing these flows always requires page.frameLocator('iframe[name^="__privateStripeFrame"]') or similar rather than a plain page.locator().

Handling New Tabs and Popup Windows

A link with target="_blank" opens content in a brand-new browser tab, which Playwright represents as a completely separate Page object that your test must explicitly capture — it does not automatically become part of the original page reference. The standard pattern wraps the triggering click in a Promise.all alongside page.waitForEvent('popup'), so Playwright captures the new Page the instant it's created, after which you can interact with it exactly like any other page: newPage.getByRole(...), newPage.locator(...), and so on.

🏏

Cricket analogy: When a target=_blank link opens a new tab, it's like a broadcaster suddenly cutting to a second, independent camera feed at the boundary that the control room must explicitly patch in — Playwright needs page.waitForEvent('popup') wrapped around the triggering click to explicitly capture that new Page object.

Handling Native Browser Dialogs

Native window.alert(), confirm(), and prompt() dialogs block the browser's entire JavaScript event loop until they're answered, and Playwright cannot click a native OS-rendered dialog directly. Instead, you register a handler before triggering the action that opens the dialog: page.on('dialog', dialog => dialog.accept()) (or dialog.dismiss(), or dialog.accept('some text') for a prompt). If no handler is registered, Playwright's default behavior automatically dismisses the dialog, which may not match what your test actually expects, leading to unexpected downstream state or, in some cases, a hung test.

🏏

Cricket analogy: A native confirm() dialog asking 'Are you sure you want to retire the batter?' blocks the entire browser event loop until answered, like a match halting completely until the on-field umpire's decision is confirmed — you must register page.on('dialog', d => d.accept()) before triggering the action, or the test hangs.

If you don't register a page.on('dialog', ...) handler before triggering the action that opens it, Playwright's default behavior is to auto-dismiss alert/confirm/prompt dialogs. This often silently diverges from what your test expects — a confirm() the app expected to be accepted gets dismissed instead — leading to confusing state mismatches or, if the app itself waits synchronously, a hung test.

  • selectOption() only works on native <select> elements; custom div-based dropdowns need click-to-open then click-option interaction.
  • page.frameLocator() scopes locators inside an iframe's separate document, since page.locator() cannot pierce into it.
  • Nested iframes require chaining multiple frameLocator() calls, one per level.
  • Payment widgets like Stripe Elements are commonly rendered in iframes for PCI compliance.
  • target=_blank links open a new, separate Page object that must be explicitly captured via page.waitForEvent('popup').
  • Native alert/confirm/prompt dialogs block the entire browser event loop and must be handled via page.on('dialog', ...).
  • Failing to register a dialog handler before the triggering action risks a hung test or an unexpected default dismissal.

Practice what you learned

Was this page helpful?

Topics covered

#Testing#PlaywrightStudyNotes#TestingQA#HandlingDropdownsFramesAndPopups#Handling#Dropdowns#Frames#Popups#StudyNotes#SkillVeris

Frequently Asked Questions

21 categories · pick one to explore

Where can I get free study notes for programming and tech subjects?
SkillVeris offers completely free study notes covering programming and tech subjects, with no signup fees or paywalls. The notes are structured by course and topic, written for quick understanding, and enriched with the Learn Through Hobbies analogy method, so you can revise concepts through cricket, music, gaming, cooking and more.
Are SkillVeris study notes good for exam revision?
Yes, the study notes are designed for efficient revision: each topic answers its heading immediately, keeps explanations concise, and links to related glossary terms and cheat sheets. Students preparing for university exams or certification tests use them as quick revision notes because they distil concepts without the padding of full textbooks.
What subjects do the free study notes cover?
The study notes span the platform's main domains, including AI and machine learning, Python and programming, web development, DevOps, cloud, security and databases. Coverage mirrors the 37 live courses, so notes exist for the topics you are actually studying, and new note sets are added as courses launch.
How are SkillVeris study notes different from regular textbooks?
The notes are answer-first, concise and free, whereas textbooks are long and often expensive. Each section explains one concept directly, then reinforces it through selectable hobby analogies like cricket or cooking. Notes also cross-link to the glossary, blog and cheat sheets, letting you jump to related material instantly instead of flipping pages.
Can I use the developer study material without creating an account?
The study notes are free to access, and SkillVeris does not charge anything for its developer study material at any point. Browsing notes is straightforward from the Study Notes section, and if you want progress tracking, certificates and AI Mentor conversations tied to your learning, a free account unlocks those extras.
Do the study notes explain concepts with analogies?
Yes, this is a signature SkillVeris feature. Study notes use the Learn Through Hobbies method, explaining technical concepts through analogies from twelve domains including cricket, music, gaming, photography, travel, movies, fitness, chess, cooking, finance, business and sports. You can switch the analogy domain instantly to whichever hobby makes the concept click.
Are the revision notes suitable for last-minute exam preparation?
Yes, revision notes on SkillVeris work well for last-minute preparation because every section states the answer in its first sentences, so skimming is genuinely effective. Pair them with the relevant cheat sheet for formulas and syntax, and use the glossary for any unfamiliar term you meet while cramming.
Is there free study material for AI and machine learning?
Yes, SkillVeris provides free study notes across its AI and ML catalogue, covering Python for AI, deep learning frameworks like PyTorch and TensorFlow, Hugging Face Transformers, Large Language Models, RAG, AI agents and MLOps. All of it is free, making it a strong resource for Indian students and global learners alike.
Can beginners understand the study notes, or are they for experts?
Beginners can absolutely use them. The notes are written in plain language, define terms as they appear, and lean on hobby analogies to make abstract ideas concrete. Difficulty scales with the underlying course level, so beginner-course notes stay gentle while advanced-course notes go deeper, and the glossary supports you throughout.
How do study notes connect with SkillVeris courses?
Study notes are organised by course and topic, so they map directly to the structured courses and their 24–40-lesson curriculum. Many learners study a lesson first, then use the matching notes for revision before module assessments and the final exam, where 80 percent is required to pass and earn the certificate.
Are there study notes for Python specifically?
Yes, Python is well covered through notes tied to the Python-focused courses, including Python for AI and ML. Topics span fundamentals through applied machine learning usage. You can reinforce the notes with Python practice in Code Lab, which runs code in your browser with no installation required.
Do the study notes include code examples?
Yes, study notes include code examples wherever a concept is best shown in code, alongside explanations, key points and analogies. Reading a snippet in the notes and then reproducing it yourself in Code Lab is an effective loop, since Code Lab lets you run code in the browser across six languages.
How often is new study material added to SkillVeris?
Study material grows alongside the course catalogue. Whenever new courses join the platform's 37 live courses, matching study notes, glossary entries and cheat sheets are added so the resources stay in sync. Existing notes are also refined over time, so it is worth revisiting topics you studied earlier.
Can I use SkillVeris notes to prepare for technical interviews?
Yes, the notes make excellent interview revision because they compress each concept into direct, answer-first explanations, which mirrors how you should answer interview questions. Combine them with the SkillVeris interview questions feature, which includes readiness scoring, to test whether your revision has actually made you interview-ready.
Are the study notes mobile-friendly for studying on the go?
Yes, the study notes are built to load fast and read comfortably on mobile devices, so you can revise during a commute or between classes. Sections are short and answer-first, which suits small screens, and analogy switching works on mobile too, letting you study anywhere without carrying books.
What is the difference between study notes and cheat sheets?
Study notes explain concepts in depth with context, examples and analogies, making them ideal for learning and revision. Cheat sheets are compact quick-reference summaries of syntax, commands and key facts, ideal once you already understand a topic. Most learners study the notes first, then keep the cheat sheet handy while coding.
Do study notes help if I am stuck on a course lesson?
Yes, reading the matching study notes often clarifies a lesson because the same concept is explained from a different angle, frequently with a different analogy. If you are still stuck, ask the AI Mentor, which answers 24/7 at Quick, Detailed or Deep-dive depth until the idea genuinely makes sense.
Is there free study material for DevOps and cloud topics?
Yes, SkillVeris carries free study notes for DevOps and cloud topics as part of its coverage across 37 live courses. The material suits learners following the DevOps Engineer or Cloud Engineer paths, and it links to related glossary terms and cheat sheets so you can revise the whole toolchain in one place.
Can school or college students in India use these notes for projects?
Yes, students across India and worldwide use SkillVeris notes for coursework, projects and exam preparation, and everything is free, which matters for student budgets. The notes explain concepts clearly enough to cite in project reports, and Code Lab lets you prototype the project code directly in your browser.
How should I combine study notes with other SkillVeris resources?
A proven loop: learn from a course lesson, revise with the matching study notes, look up unfamiliar terms in the glossary, keep the cheat sheet open while practising in Code Lab, and quiz yourself with interview questions. The AI Mentor fills any remaining gaps 24/7, at whatever depth you need.

What Learners Say

Real journeys from the SkillVeris community — swipe for more.

SkillVeris taught me Python through Cricket. Now I’m building real projects and feeling confident!
Arjun S. · B.Tech Student
The best platform for hobby-based learning. Concepts finally stick.
Priya R. · Data Analyst
I went from zero coding to a portfolio of projects — all by learning through my love for gaming. Landed my first internship!
Kabir M. · CS Undergraduate
Trending Topics50 popular tags — tap to explore
Trending CoursesAll 37 free courses — tap to browse