Add `include_shadow=` argument to `Get Page Source`
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 78/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- playwright, python, typescript
- Lĩnh vực
- backend-api-design, testing
Hướng nghiên cứu
Read Browser/keywords/getters.py and trace Get Page Source through protobuf/playwright.proto, node/playwright-wrapper/grpc-service.ts, and node/playwright-wrapper/getters.ts. Add the named include_shadow option with a default of False, and check that it reaches Playwright's page.content() call. Add coverage in atest/test/02_Content_Keywords/basic_getters.robot and a focused wrapper test; done means open shadow content appears only when enabled and existing output stays unchanged by default.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Use case
Get Page Source returns the page HTML from page.content(). Elements inside a shadow root are not in it: a web component appears as an empty host element. For pages built from web components (Lit, Stencil, Shoelace, Salesforce Lightning and similar) the page source is then nearly empty, so asserting on it, or saving it to debug a failure, shows little.
Playwright 1.64 added includeShadow to page.content(). With it, open shadow roots are written as declarative shadow DOM, <template shadowrootmode="open"> inside the host element. Closed shadow roots are never included.
Proposed keyword / arguments
Get Page Source assertion_operator=None assertion_expected=None message=None * include_shadow=False
include_shadow: named-only, defaults toFalse. WhenTrue, the content of open shadow roots is included as<template shadowrootmode="open">elements inside their hosts. Closed shadow roots are never included.
*** Test Cases ***
Page Source Shows Web Component Content
New Page ${WEB_COMPONENT_URL}
Get Page Source not contains Inside Shadow DOM
Get Page Source contains <template shadowrootmode="open"> include_shadow=True
Get Page Source contains Inside Shadow DOM include_shadow=True
Playwright API
page.content({ includeShadow }), since 1.64 (includeShadow?: booleanis intypes.d.tsof 1.64.0, not in 1.63.0).frame.content({ includeShadow }), same version.Get Page Sourcereads the page only, so this one is not needed.
Checked with Playwright 1.65.0 and Chromium: an open root comes out as <div id="host"><template shadowrootmode="open"><b>in shadow</b></template></div>, a closed root as an empty <div id="closed"></div>, and without the option the open host is empty too.
Implementation notes
All references are to upstream main (5e350998).
protobuf/playwright.proto:596:rpc GetPageSource(Request.Empty)becomesrpc GetPageSource(Request.Bool).Request.Bool(:421-423) already exists and is used for similar single flags (SetOffline,GetConsoleLog). Still one Playwright call per rpc.node/playwright-wrapper/grpc-service.ts:296-305getPageSource: takepb.Request_Booland passrequest.valueon.node/playwright-wrapper/getters.ts:380-381getPageSource(page): add the flag and callpage.content({ includeShadow }). The chunking that follows (:383-394) stays as is.Browser/keywords/getters.py:189-227get_page_source: add*, include_shadow: bool = Falseaftermessage, sendRequest().Bool(value=include_shadow)at:215, and document the argument, including that closed shadow roots are never included. The docstring also points toGet Property outerHTMLfor one element (:206-209); that does not include shadow content, which is worth one sentence.- Tests:
atest/test/02_Content_Keywords/basic_getters.robot:181-182has the plainGet Page Sourcecase. Add one againstnode/dynamic-test-app/static/webcomponent.html, which attaches an open shadow root with the heading "Inside Shadow DOM" (:24-30): that text is missing by default and present withinclude_shadow=True. There is no Jest test forgetPageSourceinnode/playwright-wrapper/__tests__/today; a small one that mockspage.contentand checks the option is passed is enough.
Backwards compatibility
Additive, named-only argument with a default that keeps today's output. The proto request type changes, but the rpc is internal to the library.
- Ngôn ngữ chính
- Python
- Star
- 662
- Fork
- 149
- Merge trung bình
- 6 giờ 13 phút
- Pull request đã merge (30 ngày)
- 121
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MarketSquare/robotframework-browser
-
priority: high
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
MarketSquare/robotframework-browser#5306 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
MarketSquare/robotframework-browser#5153 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
MarketSquare/robotframework-browser#5503 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 54/100
MarketSquare/robotframework-browser#5501 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Accept a list of credentials in `httpCredentials` of `New Context` and `New Persistent Context`Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
MarketSquare/robotframework-browser#5500 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của MarketSquare/robotframework-browser
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
igormcsouza/tether#278 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
aws-samples/sample-per-model-bedrock#803 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
huggingface/accelerate#4511 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
follow-up
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày