LogoLogo
BugBug HomepageContact SupportLoginSign up free
  • Documentation
  • Tutorial for beginners
  • Best practices
  • BugBug App FAQ
  • Quick Start
    • What is test automation?
    • Start for free
    • Create your first project
    • Install Chrome extension
    • Create and run the tests
  • Creating Tests
    • Your first test
    • Independent tests
    • Duplicating tests
    • New test from here
  • Recording tests steps
    • BugBug overlay
    • Recording clicks
    • Recording hover
    • Recording keyboard typing
    • Recording assertions
    • Recording drag & drop
    • Record from here
    • Re-recording steps
    • Recording pop-up window actions
    • Using keyboard shortcuts
  • Editing tests
    • Grouping steps
    • Components
    • Manually editing steps
    • Actions
    • Assertions
    • Tabs & iframes
    • Variables
    • Local variables
    • Profiles
    • Custom JavaScript actions
  • Running tests
    • Running the tests
    • Statuses
    • Run (locally)
    • Run and pause here
    • Run in cloud
    • Schedules
    • Parallel runs
    • Running via API
    • Test your local build or protected web page using ngrok
  • Preventing failed tests
    • Waiting conditions
    • Smart click
    • Smart scroll
    • Selectors
    • Timeout
    • Delay / Sleep
    • Project settings
  • Debugging Tests
    • Runs history
    • Screenshots
    • Debug in Chrome
    • Breakpoint (run step-by-step)
  • Organizing tests
    • Naming your tests
    • Searching tests
    • Suites
    • Components
    • Projects
  • Workflow Tips
    • Edit & Rewind
    • Changing the test screen size
    • Multiple environments
    • Testing registration & login
    • Integrating with build systems
    • Mobile version testing
  • Collaboration
    • Organizations
    • Inviting team members
    • Alerts
      • Sending email notification
      • Sending webhook
      • Sending Slack message
      • Sending Teams message
  • Integrations
    • CLI
    • Zapier
    • Slack
    • GitHub
    • Bitbucket
    • Gitlab
    • Trello
    • Jira
  • Your account
    • Account settings
    • Edit your name and email
    • Forgot password
    • Manage Subscriptions
    • Account FAQ
  • Troubleshooting
    • Prohibited behaviors
    • Updating Chrome extension
    • Clear cookies and site data for BugBug
    • Testing basic auth password protected websites
    • Common selectors issues
    • CAPTCHA in automation testing
    • Cloud tests sometimes failing
    • IPs list of cloud runners
    • VPN or a Firewall
    • A/B tests
    • Report a bug
  • IN-DEPTH GUIDES
    • Beginners tutorial to automation testing
    • XPath Selectors without coding
    • Tech Leader's Guide to Automation Testing
    • Test automation guides
  • FREE TOOLS
    • BugBug Testing Inbox
    • Example SaaS App
    • No-code XPath Selector Builder
  • Other links
    • BugBug Homepage
    • Pricing
    • Terms & conditions
    • Privacy Policy
Powered by GitBook
On this page
  • What is the "Switch context" action?
  • Locating the right frame

Was this helpful?

  1. Editing tests

Tabs & iframes

PreviousAssertionsNextVariables

Last updated 3 months ago

Was this helpful?

BugBug fully supports testing in iframes or multiple tabs. This is handled automatically during the recording but can also be controlled manually. You will notice the Switch context action if you work with iframes or multiple tabs.

What is the "Switch context" action?

When you record something in a different tab or iframe, an additional step will be recorded before the actual action for switching the context to this new frame or tab.

This defines the context for all the following test steps until you switch the context again to a different frame or a tab.

Locating the right frame

The first tab you visit during the test is Tab number 0 and context identified as Top. This is the default text execution context, and if you don't interact in your test with iframes or other tabs, you don't need to add the Switch context step.

The default test execution context is Tab number 0 and context Top, and adding this at the beginning of the test is unnecessary.

If you navigate to different tabs or iframes during the test, they will be identified by:

  • Tab number [number]

  • Context [Top|Iframe]

  • Frame element (if the context is Iframe)

Tabs are numerated from 0, so each frame you open during the recording session will have incremented numbers.

If the interaction is not in an Iframe, the context should be set to your default tab context: Top.

If the interaction is inside an iframe, the context should be set to Iframe and the correct iframe selector is needed:

A test scenario when you operate in your first tab, then in an iframe, in the nested iframe, and then again in the first tab looks like the below:

If you have mixed contexts in your tests, it's important to remember which context you're in to make sure the test works correctly.

BugBug also supports nested iframes during a regular recording session. You can read more about here.

nested selectors
Tab numbers starting from 0
Default tab context - Top
Switch to the iframe identified by XPath //IFRAME[id="frame1"] in the first browser tab (tab 0)
Switch test execution context to nested iframe
Mixed test contexts