Current limitations blocking Playwright's WebDriver BiDi adoption

オープン
#32,577 コメント 29 件 リアクション 34 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
typescript
領域
testing, web-dev

調査の方向性

まず、未チェックの制限を 1 つ選択し、参照されている Playwright テスト(たとえば tests/page/page-click.spec.ts、tests/page/page-frame-frame-element.spec.ts、page-add-init-script.spec.ts、または page-mouse.spec.ts)を読みます。期待される動作を関連する WebDriver BiDi capability と比較してから、指定されたテストとその周辺の suite を実行します。選択した制限が実装され、影響を受けるテストがより広範な BiDi suite にリグレッションを発生させずにパスすれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bidi initiative

We've spent a couple weeks adding support for Bidi to Playwright and running Playwright tests with the new protocol. The good news is there has been a large progress in Bidi support in Firefox and Chromium, many Playwright tests are now passing. However, there is still a long list of issues that are blocking Playwright from adopting Bidi as the browser automation protocol. At this point the number of bugs we identified is too large to file individual reports for each of them, instead we'll use this issue to describe some of the major problems that we've discovered.

🎉 Current stats are the following:

  • Chromium: 2368 / 3877 passed (3.2m)
  • Firefox: 1469 / 3877 passed (4.1m)

Spec

  • Provide a way to configure the viewport before a popup or new tab starts loading content. Currently, the browsingContext.SetViewport command can only be sent to an existing page, and there is no way to pause the load of a new page (e.g., opened via ctrl+click or a popup); these pages always load with the default viewport first.
  • Allow to configure options(aka capabilities) such as proxy and acceptInsecureCerts per user context rather than per session, so that same browser process can be reused for testing with different options.
  • Add support for isMobile emulation to enable fixed layout mode.
  • Allow specifying a screen size that is different from the viewport size.
  • Include support for landscape mode emulation.
  • Add support for getting content quads to ensure accurate clicking inside transformed elements. This is particularly relevant for tests involving transformed elements, as seen in tests/page/page-click.spec.ts.
  • Implement DOM.getFrameOwner and DOM.describeNode to enable converting between DOM node handles and Frame handles. This would improve the implementation of Locator.contentFrame() and FrameLocator.owner(), as the current workaround using contentWindow does not work with shadow DOM, as seen in the page/frame-frame-element.spec.ts tests.
  • Introduce an event or method to track when a navigation is committed, beyond the current DOMContentLoaded and load events, which would be useful for some client requirements (e.g., 'should return when navigation is committed if commit is specified'). We need to know immediately if the navigation has failed or succeeded.
  • Provide access to the request body (see issue: https://github.com/w3c/webdriver-bidi/issues/748).
  • Provide access to the response body (see issue: https://github.com/w3c/webdriver-bidi/issues/747).
  • Include request.resourceType support (see issue: https://github.com/w3c/webdriver-bidi/issues/704).
  • Add suggestedFileName to browsingContext.downloadWillBegin.
  • Enable retrieval of the body of a download.
  • Add locale emulation (https://github.com/w3c/webdriver-bidi/issues/774), including:
    • accept-language headers
    • JS Date and Intl APIs
    • navigator.language
  • Add support for timezone emulation (see issue: https://github.com/w3c/webdriver-bidi/issues/749).
  • Improve user agent emulation to be per user context (see https://github.com/w3c/webdriver-bidi/issues/448#issuecomment-1944294296)
    • Interception is prohibitively expensive and therefore impractical.
    • Also not all requests are intercepted, e.g. WebSocket.
  • Add support for setting extra HTTP headers per user context, same as user agent https://github.com/w3c/webdriver-bidi/issues/777
  • Allow to call script.addPreloadScript per context, so that the script is always evaluated before navigation in the page. See e.g. 'init script should run only once in popup' test in page-add-init-script.spec.ts.
  • Support offline mode emulation https://github.com/w3c/webdriver-bidi/issues/776
  • Support emulation of disabled JavaScript https://github.com/w3c/webdriver-bidi/issues/746

These are just some of the issue that we discovered while looking at the first cut. There are many other issues that are currently blocked by the ones above.

Implementation

  • Firefox: browsingContext.setViewport fails intermittently with {"type":"error","id":14,"error":"unknown error","message":"AbortError: Actor 'MessageHandlerFrame' destroyed before query 'MessageHandlerFrameParent:sendCommand' was resolved","stacktrace":""}. See this bug report.
  • Firefox: page.setContent doesn't work because of 'Error: page.setContent: SecurityError: The operation is insecure.' in utility context. Bug report
  • Firefox pointerDown/pointerUp/pointerDown/pointerUp in separate input.performActions commands don't generate dblclick event, see 'should dblclick the div' in page-mouse.spec.ts
  • Firefox: script.realmDestroyed comes after browsingContext.contextDestroyed
  • Firefox: script.evaluate exception have no details/message
  • Firefox: browsingContext.contextDestroyed comes before input.performActions response, see 'should not throw UnhandledPromiseRejection when page closes'. I.e. some events can come after browsingContext was destroyed.
  • Firefox: navigation id stays the same for different navigations, see 'should return from goto if new navigation is started'
  • Intermittent Error: Protocol error (script.evaluate): unknown error
    Message: AbortError: Actor 'MessageHandlerFrame' destroyed before query 'MessageHandlerFrameParent:sendCommand' was resolved - apparently fails if a command is sent before about:blank navigation finishes.
  • Firefox: lazy loading iframes are not reported (can be disabled in settings I think)
  • Firefox: setViewport does not affect window.screen.width/height, matchMedia, see 'should emulate device width'
  • Firefox: CSP tests are failing
  • Firefox: "url" not supported yet in network.continueRequest
  • Firefox: no requestfailed event when it's cancelled by the page, see 'should not throw if request was cancelled by the page' in
  • Firefox: 'should amend utf8 post data' - doesn't work with non-latin post data
  • Firefox: 'redirected requests should report overridden headers' - does not allow to override headers on redirects
  • Firefox: browsingContext.create sometimes hangs in parallel tests
  • Firefox: browsingContext.downloadWillBegin is not fired
  • Firefox: "Blocked request with id 15 not found" when sending network.continueWithAuth, authentication not working
  • Firefox: about:blank page is required for firefox to not close even in headless! (--silent didn't work)
  • Firefox: crash reporter dialog, can probably be fixed with settings.
  • Firefox: need canonical settings for testing browser
  • Chromium: Method 'network.setCacheBehavior' is not implemented.
主要言語
TypeScript
スター
100k
フォーク
6.9k
平均マージ
16時間 8分
マージ済み PR(30日)
281

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/playwright のほかの issue

microsoft/playwright の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。