Recommended Free Tools
Put a conditional test.skip(callback, description) inside the test.describe() block. The callback can count matches for the selector; when the count is zero, Playwright skips every test in that group and records the supplied reason.
This is different from calling test.skip() inside one test: the in-test call aborts only that running test, while the describe-level callback expresses a precondition for the whole group.
Use the group-level conditional skip
The documented Playwright Test API supports one conditional skip declaration for a test.describe() group. A locator count is appropriate when the requirement is that the selector exist in the DOM.
import { test, expect } from '@playwright/test';
const selector = '[data-testid="optional-panel"]';
test.describe('optional panel tests', () => {
test.skip(
async ({ page }) => (await page.locator(selector).count()) === 0,
`Required selector is missing: ${selector}`,
);
test('shows panel content', async ({ page }) => {
await expect(page.locator(selector)).toBeVisible();
});
});
When the callback returns true, the tests declared in that group are reported as skipped rather than failed. The description appears with the result, making it clear that the panel was absent instead of broken.
Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
The callback runs with the test fixtures, including page. Make sure the page is in the intended state before checking the locator. If the panel is rendered only after navigation, authentication, or an API response, perform that setup before the condition is evaluated; otherwise a temporary loading state can look like a genuinely missing selector.
Existence and visibility are different conditions
Choose the predicate that matches what the tests actually require. A selector can match a hidden element, so existence and visibility are not interchangeable.
Skip when no element matches
Use locator.count() === 0 when the group applies only to pages that contain the element, regardless of whether it is currently visible.
test.describe('optional panel tests', () => {
test.skip(
async ({ page }) => (await page.locator(selector).count()) === 0,
`Required selector is missing: ${selector}`,
);
// tests that require the panel to exist
});
Skip when the element is not visible
Use locator.isVisible() when the group requires a visible control or panel. Negate the result so the callback returns true for the skip case.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchestest.describe('visible panel tests', () => {
test.skip(
async ({ page }) => !(await page.locator(selector).isVisible()),
'The panel is not visible',
);
test('shows panel content', async ({ page }) => {
await expect(page.locator(selector)).toBeVisible();
});
});
isVisible() checks the current rendered state. It does not wait for an element to become visible. If visibility is expected after an action, do that action first or use an explicit wait that reflects your application’s state before evaluating the skip condition.
| Requirement | Condition | What a true result means |
|---|---|---|
| The selector must match an element | (await page.locator(selector).count()) === 0 |
No matching element exists, so skip the group |
| The matching element must be visible | !(await page.locator(selector).isVisible()) |
The element is not visible, so skip the group |
Make the check reliable
Reach the correct page state first
A zero count is meaningful only after navigation and prerequisite setup. Put shared setup in a fixture or a beforeEach that runs before the condition’s page inspection, or navigate in the test setup used by the group. The exact arrangement depends on your project’s fixtures and authentication flow.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
Use a stable selector
Prefer a contract such as data-testid when the element is optional by design. A CSS class used only for styling can change without changing the feature, causing unnecessary skips. Keep the selector in one constant so the condition, assertions, and skip message cannot drift apart.
Describe the reason
Pass a description as the second argument. For a dynamic selector, include it in a template string; for a feature switch or environment requirement, name that requirement instead. A useful reason distinguishes an intentional skip from an infrastructure failure when reviewing CI output.
Keep the group boundary intentional
Only tests that truly share the selector prerequisite should be inside the describe block. If one test can run without the panel, leave it outside or give it a separate group. A broad group-level condition can hide tests that should have exposed a regression.
Group skip versus skipping one test
Scope is the key difference:
- Group declaration:
test.skip(callback, description)insidetest.describe()applies the condition to the tests in that group. - Individual test: calling
test.skip()from inside a running test aborts that test immediately after the call. - TestInfo API:
testInfo.skip(condition, description)is an API for conditionally skipping the currently running test, not the documented describe-group declaration pattern.
Do not put a group precondition inside the first test and expect later tests to inherit it. Each test has its own execution, and an in-test skip does not declare a condition for sibling tests.
Complete patterns for common cases
Optional feature panel
import { test, expect } from '@playwright/test';
const panel = '[data-testid="optional-panel"]';
test.describe('optional panel', () => {
test.skip(
async ({ page }) => (await page.locator(panel).count()) === 0,
`Required selector is missing: ${panel}`,
);
test('contains a heading', async ({ page }) => {
await expect(page.locator(panel).getByRole('heading')).toBeVisible();
});
test('can be opened', async ({ page }) => {
await page.locator(panel).click();
});
});
Environment-dependent UI
If a feature appears only for a tenant, role, locale, or deployment, encode that fact in the description and ensure the fixture has selected that context before the callback checks the page.
test.describe('reports for tenants with analytics', () => {
test.skip(
async ({ page }) => (await page.locator('[data-testid="analytics-report"]').count()) === 0,
'Analytics report is not enabled for this tenant',
);
test('renders the report', async ({ page }) => {
await expect(page.locator('[data-testid="analytics-report"]')).toBeVisible();
});
});
Common failures and fixes
The group skips unexpectedly
Cause: the callback runs before navigation, login, or feature setup, so the selector is not present yet.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
Fix: move the page-state preparation into the fixture or setup used before the condition, and verify the URL and authentication state at that point. Do not replace a real setup problem with a skip.
A hidden element passes the existence check
Cause: count() reports matching DOM nodes even when CSS hides them.
Fix: use isVisible() when visibility is the requirement, or keep the existence check and let the test assert the intended visibility if hidden markup should count as present.
The selector matches several elements
Cause: a loose selector can satisfy the existence check while the test interacts with an unintended node.
Fix: tighten the locator, use a role or test ID, and assert the expected count where uniqueness matters. The skip condition should answer only whether the feature is available; test assertions should validate its correctness.
The skip reason is unclear in CI
Cause: no description, or a generic message such as “not found.”
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Fix: provide a description that names the selector or feature and states the requirement. Playwright recommends a description for conditional skips.
The project rejects the overload
Cause: the installed Playwright version may not support the callback overload used by current documentation.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Fix: check the API documentation for the version installed in your project before adopting the group callback form. The available reference does not establish the release in which that overload was introduced; do not assume every older dependency has it.
A test is skipped but should fail
Cause: the feature is mandatory in this environment, but the group was treated as optional.
Fix: remove the conditional skip and assert the selector directly. Skipping is appropriate only when absence is an accepted, documented condition.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Inspecting the result
Run the normal Playwright command for your project, for example npx playwright test. In the report, the affected tests should have a skipped status and the description supplied to test.skip. If no test in the group runs, inspect the callback’s condition and the page state rather than adding retries; retries do not change a selector that is genuinely absent.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Or skip the browser setup:
If your goal is to capture a page rather than exercise it, ScreenshotNeo returns a screenshot or PDF through one request. It accepts consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server provides take_screenshot, get_page_info, and capture_pdf tools for Claude, Cursor, and other MCP clients.
cURL
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
See the parameter reference and response details in the ScreenshotNeo documentation. Options include full-page captures with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets or any viewport, retina scale, PDF paper size and margins, custom CSS and JavaScript, clicks, waits, request blocking, headers, cookies, user agents, authorization, timezone, geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed image links, asynchronous webhooks, bulk capture of up to 100 URLs per call, usage data, and an OpenAPI specification. Existing parameter names used by other screenshot APIs also work.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 screenshots; every feature is included on every plan, and yearly billing provides two months free. Create a free ScreenshotNeo account to try it.
Official API references
- Playwright Test API documents conditional skips for a file or
test.describe()group. - Playwright annotations shows group-level conditional annotation patterns.
- Locator API documents
count()andisVisible(). - Page API documents page fixtures and page operations used in setup.
- TestInfo API documents per-test conditional skipping.
Frequently Asked Questions
Can I skip a describe block before any test starts?
Yes. Declare the conditional `test.skip(callback, description)` inside that `test.describe()` callback; Playwright evaluates it as the group’s condition.
Should I use `locator.count()` or `locator.isVisible()`?
Use `count()` for DOM existence and `isVisible()` when the required condition is current visibility.
Is a skipped group the same as a failed test?
No. A conditional skip records that the prerequisite was not met; it does not validate the feature. Use an assertion instead when the feature is mandatory.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

