Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Playwright में सही मोबाइल screenshot लेने के लिए पहले तय करें कि आप किसी खास फोन का व्यवहार जाँचना चाहते हैं या केवल responsive breakpoint का layout। फोन के लिए उपलब्ध device preset चुनें; breakpoint के लिए स्पष्ट viewport dimensions दें। फिर ज़रूरत के अनुसार locale और timezone सेट करें और तय करें कि screenshot केवल दिख रहे viewport का चाहिए या पूरी scrollable page का।

पहले तय करें कि “सही mobile view” से आपका मतलब क्या है

किसी वेबसाइट का domain .in होना अपने-आप किसी एक viewport, भाषा, timezone या location को सही नहीं बनाता। Configuration उस चीज़ के मुताबिक चुनें जिसे आप जाँचना चाहते हैं:

  • Responsive layout या breakpoint: चुनी हुई width और height स्पष्ट रूप से सेट करें। यह एक आकार का परीक्षण है, सभी भारतीय फोन का मानक नहीं।
  • किसी खास फोन का browser व्यवहार: Playwright की device registry में उपलब्ध और लक्ष्य से मेल खाता preset चुनें। Preset user agent, screen size, viewport और touch support जैसे parameters साथ रखता है।
  • भाषा और formatting: browser locale उस भाषा और क्षेत्र के अनुरूप रखें जिसकी site परखनी है। en-IN English (India) का उदाहरण है, हर Indian website के लिए सार्वभौमिक विकल्प नहीं।
  • स्थानीय समय: तारीख या समय पर निर्भर सामग्री के लिए Asia/Kolkata timezone सेट करें। Test runner की अपनी timezone date assertions को अलग से प्रभावित कर सकती है।
  • स्थान-आधारित सामग्री: delivery, store या local content वास्तव में location पर निर्भर हो तभी geolocation और आवश्यक permission जोड़ें। Locale और geolocation अलग settings हैं।

Playwright की आधिकारिक emulation documentation के अनुसार, उससे अलग browsers पर परीक्षण के साथ mobile phone या tablet जैसे device का emulation भी किया जा सकता है। Emulation configuration है; यह किसी वास्तविक फोन पर site की जाँच के समान नहीं है।

JavaScript में device preset से viewport screenshot लें

यह runnable उदाहरण Chromium लॉन्च करता है, Playwright के उपलब्ध Pixel 7 preset से context बनाता है और locale तथा timezone सेट करके दिखाई दे रहे viewport का PNG सहेजता है। उदाहरण का preset नाम चल रहे Playwright version की device registry में मौजूद होना चाहिए।

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Yojaro 4Pack Silicone Suction Phone Case Mount, Silicon Adhesive Smartphones Stand Sticky, Hands-Free Phone Accessories Holder for Selfies and Videos (Black & White & Translucent & Light Pink)
  • 【Strong Adsorption】The inspiration of the silicone phone suction case comes from the adhesive force of the octopus. Each suction cup phone mount is 3.15 inches long and 2.17 inches wide, with 24 independent suction cups providing a stronger and more stable suction force, so you don't have to worry about your phone falling during use.
  • 【Back of Phone Suction Grip】Remove the adhesive film on the phone suction cup and stick it on the phone case. You can then fix the phone on any smooth surface, which is very convenient. (The phone suction cup cannot be removed and reused after being attached to the phone case. It is recommended to attach it to a regular phone case, not a valuable one.)
  • 【Widely Used】Our non-slip silicone phone sticky grip mount attaches to almost any flat phone case and make it compatible with common mobile phones such as iPhone and Android.You can shoot, watch videos or video calls in the kitchen, gym, dance studio, bathroom and other places.
  • 【Capture the Wonderful Picture】Whether you are a TikTok creator or just like to share videos and photos, this phone suction cup can help you hands-free capture wonderful videos and photos for sharing with friends.
  • 【Note】You can fix the phone suction cup on a smooth surface such as a mirror or glass. If necessary, wipe the suction cup with a damp cloth to obtain stronger suction. Before releasing your hand, make sure the phone is firmly fixed. (Not applicable to rough walls, wooden surfaces, and other uneven surfaces)
const { chromium, devices } = require('playwright');

(async () => {
  const browser = await chromium.launch();
  try {
    const context = await browser.newContext({
      ...devices['Pixel 7'], // अपने installed Playwright version में उपलब्ध preset चुनें
      locale: 'en-IN',
      timezoneId: 'Asia/Kolkata',
    });
    const page = await context.newPage();
    await page.goto('https://example.in', { waitUntil: 'load' });
    await page.screenshot({ path: 'indian-mobile-viewport.png' });
    await context.close();
  } finally {
    await browser.close();
  }
})();

इसे mobile-shot.js नाम से सहेजकर उस project में node mobile-shot.js चलाएँ जहाँ Playwright स्थापित है। https://example.in को उस पते से बदलें जिसका परीक्षण करना है। इस call में fullPage नहीं है, इसलिए screenshot वर्तमान viewport तक सीमित है।

Preset के बाद overrides रखें

Preset अपनी viewport values देता है। अगर किसी breakpoint को परखने के लिए dimensions बदलनी हों, तो viewport को preset spread के बाद रखें:

Rank #2
Apple EarPods Headphones with USB-C Plug, Wired Ear Buds with Built-in Remote to Control Music, Phone Calls, and Volume
  • SUPERIOR COMFORT — Unlike traditional circular ear buds, the design of EarPods is defined by the geometry of the ear. Which makes them more comfortable for more people than any other ear bud–style headphones.
  • HIGH-QUALITY AUDIO — The speakers inside EarPods have been engineered to maximize sound output and minimize sound loss, which means you get high-quality audio.
  • BUILT-IN REMOTE — EarPods with USB-C plug also include a built-in remote that lets you adjust the volume, control the playback of music and video, and answer or end calls with a pinch of the cord.
  • COMPATIBILITY — Works with all devices that have a USB-C port.
  • INTEGRATED MICROPHONE — A built-in microphone precisely captures your voice while you’re on the phone, taking a FaceTime call, or summoning Siri — so you’re always heard loud and clear.
const context = await browser.newContext({
  ...devices['Pixel 7'],
  viewport: { width: 390, height: 844 },
  locale: 'en-IN',
  timezoneId: 'Asia/Kolkata',
});

390 × 844 केवल स्पष्ट dimensions दिखाने का उदाहरण है—इसे भारत के सभी phones का प्रतिनिधि आकार न मानें। Preset का isMobile व्यवहार बनाए रखें, जब तक आप जानबूझकर अलग mobile behavior की तुलना नहीं कर रहे हों। सिर्फ viewport छोटा करना mobile emulation का पूरा विकल्प नहीं है: isMobile meta viewport को ध्यान में रखने और touch events सक्षम करने से जुड़ा है।

Python में यही configuration

Python का synchronous API इस्तेमाल करने पर समान preset, locale और timezone इस तरह दिए जा सकते हैं:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
PopSockets Adhesive Phone Grip, Holder- Black
  • Secure Hold: Our PopSockets adhesive phone grip gives your cell phone a secure, comfortable hold in hand to help prevent drops while texting, taking photos, or scrolling on the go. Designed to stick firmly to most phone cases and devices.
  • Hands-Free Made Easy: Easily turn your PopSocket into a phone stand to prop up your phone anywhere, perfect for watching videos, video calls, or following recipes. A must-have phone holder that keeps your device secure and ready for anything.
  • Compatibility: Works with all phones, tablets, and Kindles. Sticks best to smooth, hard plastic cases and may not adhere to silicone or textured cases. Easily swap your PopTop to change up your style.
  • Black PopSockets: Simple, refined, and endlessly versatile. A timeless essential for any phone.
  • Travel Must-Have for People On the Go: A must-have travel accessory for flights, flying, airports, air travel, airplanes, planes, international trips, cruises, and long travel days. Key gadget for your airport haul, travel accessories and must-haves.
from playwright.sync_api import sync_playwright

with sync_playwright() as p:
    browser = p.chromium.launch()
    try:
        context = browser.new_context(
            **p.devices['Pixel 7'],  # अपने Playwright version का उपलब्ध preset चुनें
            locale='en-IN',
            timezone_id='Asia/Kolkata',
        )
        page = context.new_page()
        page.goto('https://example.in', wait_until='load')
        page.screenshot(path='indian-mobile-viewport.png')
        context.close()
    finally:
        browser.close()

यदि responsive breakpoint जाँचना है, तो Python में भी preset के बाद viewport={"width": 390, "height": 844} दें। Python में timezone option का नाम timezone_id है; JavaScript में वही setting timezoneId कहलाती है।

Viewport screenshot, full-page capture और pixel scale में फर्क

सामान्य page.screenshot() call दिखाई दे रहे viewport को सहेजता है। पूरी scrollable page चाहिए तो ही full-page विकल्प चुनें। दोनों artifacts के dimensions अलग हो सकते हैं, इसलिए visual regression में viewport captures की तुलना viewport captures से और full-page captures की तुलना full-page captures से करें।

Rank #4
360° Rotating Stainless Steel Phone Tether Tab (Silvery 3-Pack) - Universal for iPhone & Other Phones (Fits Wristbands/Necklaces/Crossbody Straps)
  • [360 ° Flexible Rotation Design] Comes with a rotatable lanyard ring that supports 360 ° free rotation, effectively solving the problem of twisted and tangled lanyards
  • [Wide compatibility] The ultra-thin 0.02-inch design does not block the charging port at all, and both wired and wireless charging can be used directly without removing the pad. Compatible with most smartphones such as iPhone, compatible with various wristbands, lanyards, crossbody straps, and keychains
  • [Durable and Portable Material] Premium rust-resistant stainless steel material with good flexibility, which not only avoids scratching the phone case, but also has excellent anti rust and anti fading performance
  • [Multi scenario Practical] Paired with a lanyard or wristband, hands-free use can be achieved. The phone is within reach and not easily dropped, ideal for daily commuting and outdoor activities. Suitable for full coverage phone cases, does not support half coverage phone cases
  • [Quality Service] If you find any damage or other issues with the product upon receipt, please contact us immediately. We will handle it quickly
// पूरी scrollable page
await page.screenshot({ path: 'indian-mobile-full.png', fullPage: true });

Python में इसका समकक्ष page.screenshot(path='indian-mobile-full.png', full_page=True) है।

निर्णय विकल्प कब चुनें
Device configuration Named device preset जब लक्ष्य किसी खास preset के device parameters हों।
Device configuration Custom viewport जब लक्ष्य responsive breakpoint के निश्चित width और height हों।
Screenshot extent Viewport जब दिख रही first screen या fixed viewport layout जाँचना हो।
Screenshot extent fullPage: true जब पूरी scrollable document चाहिए।
Output scale scale: 'css' जब हर CSS pixel के लिए एक screenshot pixel चाहिए।
Output scale scale: 'device' जब output device pixel ratio के अनुरूप high-DPI image होनी चाहिए।

Viewport के CSS dimensions और image file के physical pixel dimensions को एक न समझें। Screenshot विकल्पों का व्यवहार Playwright API parameters documentation में दिया गया है। JavaScript में scale चुनने का उदाहरण:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anteel 2 Pack Silicone Suction Cup Phone Case Mount Double Sided, Hands-Free Silicon Phone Grip with Higher Suction Power for Selfies and Videos, Non Slip Phone Accessories (LightPink&White)
  • 【PKYAA Double Sided Silicone Suction Phone Case Mount】PKYAA With Double Sided 40 Strong and Reliable individual suction cups, PKYAA provides a thicken and upgraded universal silicon suction mount for your phone.
  • 【Friendly to Content Creators】If you are a content creator or an online influencer, you can create videos anywhere with this suction mount completely hands free with this silicone cell phone mount for cases.
  • 【HANDS-FREE & Adhere to Mirrors】This Double Sided silicone suction phone case mount allows you to stick your phone to the mirror easily. No longer holding your phone in one hand to watch video tutorials while making up.
  • 【Strong Grip on the Smooth Surface】You can easily hang your phone anywhere with a smooth surface. All you do is you clean off your phone and smooth surface. It is STURDY and it not only sticks to mirrors, it also sticks to windows, it sticks to refrigerators, tiles and other clean, flat surfaces.
  • 【Press Down Firmly Every 30 Minutes】Use your palm or fingers to press the phone down firmly and check it's secure before letting go. Apply even pressure for a few seconds to allow the suction cup to adhere properly. To maintain the grip and prevent accidental falls, it's a good practice to periodically reapply pressure to the suction cup.
await page.screenshot({
  path: 'indian-mobile-css-scale.png',
  scale: 'css',
});

Python में विकल्पों के नाम snake_case होते हैं; उदाहरण के लिए full-page capture के लिए full_page=True।

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Site के व्यवहार के अनुसार capture को भरोसेमंद बनाएँ

सही emulation अपने-आप हर page state को screenshot-ready नहीं बनाता। किसी site पर redirect, consent banner, authentication, location logic या देर से लोड होने वाली सामग्री हो सकती है। इन स्थितियों को test के उद्देश्य के अनुसार संभालें, और screenshot से पहले आवश्यक page state तक पहुँचें।

  • देर से आने वाला content: मनमाने लंबे delay के बजाय उस महत्वपूर्ण element के आने की प्रतीक्षा करें, जैसे await page.locator('main').wait_for()।
  • Lazy-loaded images: full-page capture से पहले यह पुष्टि करें कि page के आवश्यक हिस्से लोड हो चुके हैं। केवल screenshot call से यह मानकर न चलें कि हर lazy image तैयार है।
  • Consent या login state: परीक्षण के लिए उपयुक्त storage state, cookies या UI flow तय करें। अलग state वाले screenshots को एक ही visual baseline न मानें।
  • Location पर निर्भर सामग्री: केवल जरूरत पड़ने पर geolocation और browser permission configure करें; timezone देना location देने के बराबर नहीं है।
  • Repeatable visual tests: preset या custom viewport, locale, timezone और capture extent को हर run में समान रखें। इससे तुलना में अनचाहे configuration बदलाव कम होंगे।

आम समस्याएँ और उनके समाधान

लक्षण संभावित कारण क्या करें
devices['Pixel 7'] undefined है चल रहे Playwright version की registry में वह नाम उपलब्ध नहीं है या spelling मेल नहीं खाती। उसी installed package की device registry में मौजूद नाम चुनें; preset का नाम मानकर न लिखें।
मोबाइल layout नहीं दिख रहा केवल छोटा viewport दिया गया है, या चुने गए context में अपेक्षित mobile settings नहीं हैं। लक्ष्य device preset से शुरू करें। Breakpoint-only test में dimensions स्पष्ट रखें और यह जाँचें कि आवश्यक isMobile व्यवहार context में बना हुआ है।
भाषा या तारीख अपेक्षा से अलग है Site अपनी भाषा/समय logic अलग तरह से लागू कर सकती है; runner की timezone भी date assertions पर असर डाल सकती है। Context locale और timezone की पुष्टि करें, और जाँचें कि test runner की timezone आपकी अपेक्षा से टकरा तो नहीं रही।
Screenshot में banner, अधूरा content या पुरानी state है Capture से पहले consent, authentication, navigation या asynchronous content तैयार नहीं हुआ। सही test state बनाएँ और screenshot से पहले जरूरी selector या page condition की प्रतीक्षा करें।
Image का pixel आकार viewport से बड़ा है scale: 'device' device pixels के अनुसार output बना सकता है। जब एक CSS pixel प्रति image pixel चाहिए, scale: 'css' इस्तेमाल करें; अन्यथा device-scale output को अपेक्षित परिणाम मानें।
नीचे के हिस्से capture में नहीं हैं Default screenshot केवल viewport का है। पूरी scrollable document चाहिए तो fullPage: true (Python में full_page=True) दें।

Or skip the browser setup: ScreenshotNeo से एक call

यदि अपना Playwright browser context चलाने के बजाय screenshot API चाहिए, तो ScreenshotNeo एक विकल्प है। यह URL लेकर PNG, JPEG, WebP या PDF देता है। नीचे cURL call में target URL अपने पते से बदलें; API विकल्पों के लिए ScreenshotNeo documentation देखें।

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.in -o shot.webp

ScreenshotNeo capture से पहले cookie/consent banner स्वीकार करता है और 60 से अधिक ज्ञात consent platforms के साथ newsletter popups और chat widgets हटाता है; हर कदम बंद किया जा सकता है। Bot checks/CAPTCHAs, blank pages, timeouts, failed loads और cache hits के लिए शुल्क नहीं लगता, और response X-Page-Verdict तथा X-Billed headers से परिणाम बताता है। इसमें AI agents के लिए MCP server भी है, जिसके tools take_screenshot, get_page_info और capture_pdf हैं। Free plan में बिना card के प्रति माह 1,000 screenshots शामिल हैं; paid plans $5 में 3,000 से शुरू होते हैं।

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

ScreenshotNeo पर मुफ्त account बनाएँ: हर महीने 1,000 screenshots, बिना card के।

Frequently Asked Questions

क्या Playwright screenshot किसी असली फोन पर ली गई तस्वीर के बराबर है?

नहीं। Playwright device emulation चुने गए device parameters के साथ browser test करने का तरीका है; वास्तविक hardware, OS और network परिस्थितियों की जाँच अलग होती है।

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.