microsoft / playwright

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
https://playwright.dev
Apache License 2.0
66.82k stars 3.66k forks source link

[BUG] Ah Snap Error 5 using playwright 1.38.1 chromium on macOs 13/14 #27363

Closed anandtiwari1 closed 1 year ago

anandtiwari1 commented 1 year ago

System info

Source code

Link to the GitHub repository with the repro

Config file

// playwright.config.ts
import { defineConfig, devices } from '@playwright/test';

export default defineConfig({
  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], },
    },
  ]
});

Test file (self-contained)

test('test ah snap @error', async ({ page }) => {
  await page.goto('xxx');
  await page.mouse.wheel(0, 800);
  await page.getByRole('button', { name: 'I accept' }).click();
  await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Credit Rating').selectOption('tier_1');
  await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Length of Loan').selectOption('finance_term_60');
  await page.frameLocator('iframe[title="DealStarter Widget"]').getByRole('button', { name: 'Next: Calculate Taxes' }).click();
  await page.frameLocator('iframe[title="ShopperPlatform Modal"]').frameLocator('#mmd-frame-shopperplatform').locator('.middle-container').click();
});

Steps

Expected

Test should run successful without flaky error

Actual

Test is failing intermittently and getting following error:


[chromium] › example.spec.ts:3:5 › test ah snap @error
 ────────────────────────────────────────

    Error: locator.selectOption: Target crashed
    =========================== logs ===========================
    waiting for frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Length of Loan')
      locator resolved to <select id="finance-terms" name="finance-terms" class="s…>…</select>
      selecting specified option(s)
    element was detached from the DOM, retrying
    ============================================================

       6 |   await page.getByRole('button', { name: 'I accept' }).click();
       7 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Credit Rating').selectOption('tier_1');
    >  8 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Length of Loan').selectOption('finance_term_60');
         |                                                                                              ^
       9 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByRole('button', { name: 'Next: Calculate Taxes' }).click();
      10 |   await page.frameLocator('iframe[title="ShopperPlatform Modal"]').frameLocator('#mmd-frame-shopperplatform').locator('.middle-container').click();
      11 | });

        at /Users/xx/workspace/playwright-bug/tests/example.spec.ts:8:94```
yury-s commented 1 year ago

It seems that the page is crashing browser sometimes. Since it only started in 1.38 it might be a new bug in recent browser updates. What OS is this? Can you try running with DEBUG=pw:browser to see if there a crash log in the terminal?

anandtiwari1 commented 1 year ago

@yury-s I am able to reproduce it on macOs 13/14. Also, observed the same on linux (Ubuntu 22.04). here are the browser logs:



Running 1 test using 1 worker
[chromium] › example.spec.ts:3:5 › test ah snap @error
  pw:browser <launching> /Users/xx/Library/Caches/ms-playwright/chromium-1080/chrome-mac/Chromium.app/Contents/MacOS/Chromium --disable-field-trial-config --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-back-forward-cache --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-component-update --no-default-browser-check --disable-default-apps --disable-dev-shm-usage --disable-extensions --disable-features=ImprovedCookieControls,LazyFrameLoading,GlobalMediaControls,DestroyProfileOnBrowserClose,MediaRouter,DialMediaRouteProvider,AcceptCHFrame,AutoExpandDetailsElement,CertificateTransparencyComponentUpdater,AvoidUnnecessaryBeforeUnloadCheckSync,Translate --allow-pre-commit-input --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --force-color-profile=srgb --metrics-recording-only --no-first-run --enable-automation --password-store=basic --use-mock-keychain --no-service-autorun --export-tagged-pdf --enable-use-zoom-for-dsf=false --no-sandbox --user-data-dir=/var/folders/xf/yv_g1dnx3s1_sjrrc86bst4w0000gq/T/playwright_chromiumdev_profile-MoROW4 --remote-debugging-pipe --no-startup-window +0ms
  pw:browser <launched> pid=40116 +2ms
  pw:browser [pid=40116][err] [40116:259:0929/174145.080348:ERROR:policy_logger.cc(154)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(163) Cloud management controller initialization aborted as CBCM is not enabled. +619ms
  pw:browser [pid=40116][err]  +10s
  pw:browser [pid=40116][err]  +0ms
  pw:browser [pid=40116][err] # +0ms
  pw:browser [pid=40116][err] # Fatal error in , line 0 +0ms
  pw:browser [pid=40116][err] # Check failed: handler. +0ms
  pw:browser [pid=40116][err] # +0ms
  pw:browser [pid=40116][err] # +0ms
  pw:browser [pid=40116][err] # +0ms
  pw:browser [pid=40116][err] #FailureMessage Object: 0x16d657bf80   Chromium Framework                  0x00000001186a2984 base::debug::CollectStackTrace(void**, unsigned long) + 28 +49ms
  pw:browser [pid=40116][err] 1   Chromium Framework                  0x000000011869624c base::debug::StackTrace::StackTrace() + 24 +0ms
  pw:browser [pid=40116][err] 2   Chromium Framework                  0x000000011a0fc50c gin::(anonymous namespace)::PrintStackTrace() + 40 +0ms
  pw:browser [pid=40116][err] 3   Chromium Framework                  0x0000000119e3a448 V8_Fatal(char const*, ...) + 268 +0ms
  pw:browser [pid=40116][err] 4   Chromium Framework                  0x000000011610fad8 v8_inspector::InjectedScript::ProtocolPromiseHandler::catchCallback(v8::FunctionCallbackInfo<v8::Value> const&) + 0 +0ms
  pw:browser [pid=40116][err] 5   ???                                 0x0000000147e4f6b4 0x0 + 5501154996 +0ms
  pw:browser [pid=40116][err] 6   ???                                 0x0000000147f44bd8 0x0 + 5502159832 +0ms
  pw:browser [pid=40116][err] 7   ???                                 0x0000000147e759ac 0x0 + 5501311404 +0ms
  pw:browser [pid=40116][err] 8   ???                                 0x0000000147e4af98 0x0 + 5501136792 +0ms
  pw:browser [pid=40116][err] 9   Chromium Framework                  0x0000000115a241f8 v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 1788 +0ms
  pw:browser [pid=40116][err] 10  Chromium Framework                  0x0000000115a24aac v8::internal::(anonymous namespace)::InvokeWithTryCatch(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) + 88 +0ms
  pw:browser [pid=40116][err] 11  Chromium Framework                  0x0000000115a24c78 v8::internal::Execution::TryRunMicrotasks(v8::internal::Isolate*, v8::internal::MicrotaskQueue*) + 64 +0ms
  pw:browser [pid=40116][err] 12  Chromium Framework                  0x0000000115a4cf60 v8::internal::MicrotaskQueue::RunMicrotasks(v8::internal::Isolate*) + 320 +0ms
  pw:browser [pid=40116][err] 13  Chromium Framework                  0x0000000115a4cdd0 v8::internal::MicrotaskQueue::PerformCheckpointInternal(v8::Isolate*) + 76 +0ms
  pw:browser [pid=40116][err] 14  Chromium Framework                  0x0000000115918a54 v8::MicrotasksScope::~MicrotasksScope() + 116 +0ms
  pw:browser [pid=40116][err] 15  Chromium Framework                  0x000000011614ad10 v8_inspector::(anonymous namespace)::innerCallFunctionOn(v8_inspector::V8InspectorSessionImpl*, v8_inspector::InjectedScript::Scope&, v8::Local<v8::Value>, v8_inspector::String16 const&, v8_crdtp::detail::PtrMaybe<std::__Cr::vector<std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::CallArgument, std::__Cr::default_delete<v8_inspector::protocol::Runtime::CallArgument>>, std::__Cr::allocator<std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::CallArgument, std::__Cr::default_delete<v8_inspector::protocol::Runtime::CallArgument>>>>>, bool, std::__Cr::unique_ptr<v8_inspector::WrapOptions, std::__Cr::default_delete<v8_inspector::WrapOptions>>, bool, bool, v8_inspector::String16 const&, bool, std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::Backend::CallFunctionOnCallback, std::__Cr::default_delete<v8_inspector::protocol::Runtime::Backend::CallFunctionOnCallback>>) + 852 +0ms
  pw:browser [pid=40116][err] 16  Chromium Framework                  0x000000011614a704 v8_inspector::V8RuntimeAgentImpl::callFunctionOn(v8_inspector::String16 const&, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp::detail::PtrMaybe<std::__Cr::vector<std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::CallArgument, std::__Cr::default_delete<v8_inspector::protocol::Runtime::CallArgument>>, std::__Cr::allocator<std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::CallArgument, std::__Cr::default_delete<v8_inspector::protocol::Runtime::CallArgument>>>>>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<int>, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::ValueMaybe<v8_inspector::String16>, v8_crdtp::detail::ValueMaybe<bool>, v8_crdtp::detail::PtrMaybe<v8_inspector::protocol::Runtime::SerializationOptions>, std::__Cr::unique_ptr<v8_inspector::protocol::Runtime::Backend::CallFunctionOnCallback, std::__Cr::default_delete<v8_inspector::protocol::Runtime::Backend::CallFunctionOnCallback>>) + 1464 +1ms
  pw:browser [pid=40116][err] 17  Chromium Framework                  0x0000000116102324 v8_inspector::protocol::Runtime::DomainDispatcherImpl::callFunctionOn(v8_crdtp::Dispatchable const&) + 640 +0ms
  pw:browser [pid=40116][err] 18  Chromium Framework                  0x0000000116162164 v8_crdtp::UberDispatcher::DispatchResult::Run() + 56 +0ms
  pw:browser [pid=40116][err] 19  Chromium Framework                  0x0000000116143d00 v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView) + 468 +0ms
  pw:browser [pid=40116][err] 20  Chromium Framework                  0x000000011b9a3cc4 blink::DevToolsSession::DispatchProtocolCommandImpl(int, WTF::String const&, base::span<unsigned char const, 18446744073709551615ul>) + 268 +0ms
  pw:browser [pid=40116][err] 21  Chromium Framework                  0x00000001177820f4 blink::mojom::blink::DevToolsSessionStubDispatch::Accept(blink::mojom::blink::DevToolsSession*, mojo::Message*) + 200 +0ms
  pw:browser [pid=40116][err] 22  Chromium Framework                  0x0000000118c8d550 mojo::InterfaceEndpointClient::HandleValidatedMessage(mojo::Message*) + 692 +0ms
  pw:browser [pid=40116][err] 23  Chromium Framework                  0x0000000118c91e90 mojo::MessageDispatcher::Accept(mojo::Message*) + 260 +0ms
  pw:browser [pid=40116][err] 24  Chromium Framework                  0x0000000118c8e854 mojo::InterfaceEndpointClient::HandleIncomingMessage(mojo::Message*) + 72 +0ms
  pw:browser [pid=40116][err] 25  Chromium Framework                  0x00000001190118d4 IPC::(anonymous namespace)::ChannelAssociatedGroupController::AcceptOnEndpointThread(mojo::Message) + 264 +0ms
  pw:browser [pid=40116][err] 26  Chromium Framework                  0x0000000118c90368 base::internal::Invoker<base::internal::BindState<void (mojo::(anonymous namespace)::ThreadSafeInterfaceEndpointClientProxy::*)(mojo::Message), scoped_refptr<mojo::(anonymous namespace)::ThreadSafeInterfaceEndpointClientProxy>, mojo::Message>, void ()>::RunOnce(base::internal::BindStateBase*) + 64 +0ms
  pw:browser [pid=40116][err] 27  Chromium Framework                  0x000000011864ca6c base::TaskAnnotator::RunTaskImpl(base::PendingTask&) + 304 +0ms
  pw:browser [pid=40116][err] 28  Chromium Framework                  0x0000000118662238 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) + 804 +0ms
  pw:browser [pid=40116][err] 29  Chromium Framework                  0x0000000118661dd4 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() + 100 +0ms
  pw:browser [pid=40116][err] 30  Chromium Framework                  0x0000000118609db4 base::MessagePumpDefault::Run(base::MessagePump::Delegate*) + 120 +0ms
  pw:browser [pid=40116][err] 31  Chromium Framework                  0x0000000118662ad4 base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) + 332 +0ms
  pw:browser [pid=40116][err] 32  Chromium Framework                  0x000000011862fcd0 base::RunLoop::Run(base::Location const&) + 484 +0ms
  pw:browser [pid=40116][err] 33  Chromium Framework                  0x000000011ddfbe38 content::RendererMain(content::MainFunctionParams) + 1312 +0ms
  pw:browser [pid=40116][err] 34  Chromium Framework                  0x0000000117aeaee4 content::RunOtherNamedProcessTypeMain(std::__Cr::basic_string<char, std::__Cr::char_traits<char>, std::__Cr::allocator<char>> const&, content::MainFunctionParams, content::ContentMainDelegate*) + 596 +0ms
  pw:browser [pid=40116][err] 35  Chromium Framework                  0x0000000117aebbd8 content::ContentMainRunnerImpl::Run() + 688 +0ms
  pw:browser [pid=40116][err] 36  Chromium Framework                  0x0000000117aea134 content::RunContentProcess(content::ContentMainParams, content::ContentMainRunner*) + 836 +0ms
  pw:browser [pid=40116][err] 37  Chromium Framework                  0x0000000117aea5d0 content::ContentMain(content::ContentMainParams) + 128 +0ms
  pw:browser [pid=40116][err] 38  Chromium Framework                  0x0000000114845010 ChromeMain + 472 +0ms
  pw:browser [pid=40116][err] 39  Chromium Helper (Renderer)          0x00000001027a4a6c main + 364 +0ms
  pw:browser [pid=40116][err] 40  dyld                                0x00000001872f1058 start + 2224 +0ms
  pw:browser [pid=40116] <gracefully close start> +6s
  pw:browser [pid=40116] <process did exit: exitCode=0, signal=null> +54ms
  pw:browser [pid=40116] starting temporary directories cleanup +0ms
  pw:browser [pid=40116] finished temporary directories cleanup +54ms
  pw:browser [pid=40116] <gracefully close end> +0ms
  1) [chromium] › example.spec.ts:3:5 › test ah snap @error ────────────────────────────────────────

    Error: locator.selectOption: Target crashed
    =========================== logs ===========================
    waiting for frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Length of Loan')
      locator resolved to <select id="finance-terms" name="finance-terms" class="s…>…</select>
      selecting specified option(s)
    element was detached from the DOM, retrying
    ============================================================

       6 |   await page.getByRole('button', { name: 'I accept' }).click();
       7 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Credit Rating').selectOption('tier_1');
    >  8 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByLabel('Length of Loan').selectOption('finance_term_60');
         |                                                                                              ^
       9 |   await page.frameLocator('iframe[title="DealStarter Widget"]').getByRole('button', { name: 'Next: Calculate Taxes' }).click();
      10 |   await page.frameLocator('iframe[title="ShopperPlatform Modal"]').frameLocator('#mmd-frame-shopperplatform').locator('.middle-container').click();
      11 | });

        at /Users/xx/home-workspace/playwright-bug/tests/example.spec.ts:8:94

  1 failed
    [chromium] › example.spec.ts:3:5 › test ah snap @error ─────────────────────────────────────────
yury-s commented 1 year ago

Can you try running with chromium-with-symbols, which might give us a bit more detailed stack?

Update the project to use corresponding channel:

  projects: [
    {
      name: 'chromium',
      use: { ...devices['Desktop Chrome'], channel: 'chromium-with-symbols' },
    },
  ]

You need to install the browser with npx playwright install chromium-with-symbols

yury-s commented 1 year ago

Please disregard my previous comment. The crash was likely fixed in Chromium by https://chromium-review.googlesource.com/c/v8/v8/+/4753431/2/src/inspector/injected-script.cc Can you try running the test with @playwright/test@next and see if the problem is gone?

anandtiwari1 commented 1 year ago

seems the issue is resolved with @playwright/test@next. I'll continue debugging! Thank you so much for you help @yury-s.

mikicymulate commented 1 year ago

It also happens to me when using WIN 10/11 . I tried in playwright version 1.38.0 + 1.38.1 + 1.39.0-alpha-oct-2-2023 The exact same test works in FireFox

image image

mmeir11 commented 1 year ago

It's happen to me also, fix it ASAP please!!

yury-s commented 1 year ago

@mikicymulate please file a separate issue with the stack dump, it's likely a different issue.

yury-s commented 1 year ago

seems the issue is resolved with @playwright/test@next. I'll continue debugging! Thank you so much for you help @yury-s.

Awesome, thanks for confirming. Closing this as the fix is going to be available in 1.39.

gleekzorp commented 1 year ago

I was having this same issue with 1.38.1 and after updating to 1.39 the issue has gone away

saadahmsiddiqui commented 2 months ago

Experiencing the same issue on Fedora 40 and "@playwright/test": "^1.40.1", the crash is random and sometimes doesn't happen