IndexError masks failures from JavaScript extension keywords with *args
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ó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 75/100
Hướng nghiên cứu
Bắt đầu với _get_selector_value_from_keyword_call() trong Browser/browser.py và theo dõi cách hàm này khớp các giá trị được truyền với chữ ký keyword. Tái hiện sự cố bằng tiện ích mở rộng JavaScript và bài kiểm thử Robot được cung cấp. Hoàn thành khi lỗi báo lỗi gốc boom: ["a","b"] thay vì phát sinh IndexError.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When a JavaScript extension keyword declares a parameter named args and is called with multiple positional arguments, a keyword failure can be replaced by an IndexError during Browser’s failure handling. This hides the original exception and makes the failure difficult to diagnose.
To Reproduce
Steps to reproduce the behavior:
JavaScript extension:
async function boom(args) {
throw new Error(`boom: ${JSON.stringify(args)}`);
}
exports.Boom = boom;
Robot test:
*** Test Cases ***
Failure Should Preserve Original Error
Boom a b
Expected behavior
The JavaScript keyword receives both values, but the failure handling path raises IndexError: list index out of range while inspecting the keyword arguments, instead of reporting the original boom: ["a","b"] error.
cause
The generated Python signature turns a JavaScript parameter called args into *args. When _get_selector_value_from_keyword_call() tries to match the values passed to the keyword with the keyword signature, it checks the actual values instead of the signature itself. With multiple values, it can end up looking past the end of the signature and throw an IndexError.
suggested fix
Change _get_selector_value_from_keyword_call() method to:
def _get_selector_value_from_keyword_call(self, name, args, kwargs):
selector = kwargs.get("selector")
if not selector and args:
arguments = self.get_keyword_arguments(name)
for i, arg in enumerate(args):
if i >= len(arguments):
break
spec = arguments[i][0] if isinstance(arguments[i], tuple) else arguments[i]
if spec.startswith("*"):
break
if spec.startswith("selector"):
selector = arg
break
return selector
Desktop (please complete the following information):
- OS: Windows 11
- Browser: chromium
- Version: 151.0.7922.34
- 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
-
Độ 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ó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
MarketSquare/robotframework-browser#5502 ·
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