Switch Window sporadically fails with TypeError
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- testing-qa
Hướng nghiên cứu
Bắt đầu trong src/SeleniumLibrary/locators/windowmanager.py, tại dòng unpack kết quả của execute_script("return [ window.id, window.name ];"). Tái hiện kịch bản Switch Window với một tab mới mở trễ và kiểm tra phần xử lý exception hiện có cùng luồng timeout. Hoàn tất khi TypeError xảy ra không liên tục được xử lý mà không làm hỏng việc chuyển đổi cửa sổ hoặc hành vi timeout được yêu cầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Observed with
Python 3.13.0
SeleniumLibrary 6.7.1
Scenario
I have the following scenario in a test which fails sporadically:
- Link in an (internal) application is clicked which opens a different URL in a new tab
Switch Windowis called with the expected URL as locator and10 sas a timeout
Expected behaviour
The new window is switched to. If the window is not immediately available/ready when this keyword is started, it should wait until the window can be switched to, within the given timeout limits.
Error
This works just fine most of the time, but occasionally I get the following error:
TypeError: cannot unpack non-iterable NoneType object
This error shows up pretty much instantly (within a few hundred ms), so the timeout is not taken into account.
However, in the associated screenshots, the expected page is always shown.
Analysis
I looked into the library's code and added some extra logging, which showed the error was coming from this line:
https://github.com/robotframework/SeleniumLibrary/blob/ce9d0ec510bd99c5a1b1cd114f767c7feeae1208/src/SeleniumLibrary/locators/windowmanager.py#L199
The call to self.driver.execute_script("return [ window.id, window.name ];") returns None, thus the assignment to the two variables fails with the above error.
Adding a 1 s sleep right before the call to execute_script makes the error no longer occur (even with many iterations of the test), so it does seem to be somehow timing related.
I guess there's a short timeframe where the window is there but not fully ready and this makes the function call fail? But I wasn't able to understand the exact nature of this presumed 'not ready' state so far.
Proposed solution
The TypeError could be added to the already present except, which successfully avoided failures due to this in my scenario.
Adding this would be trivial, but I'm not sure about the implications:
- does anything depend on the current behaviour that raises an error in this case (seems not, but I'm not super familiar with the library's codebase)?
- would it be appropriate to suppress this error in the library, given it is not fully understood what exactly the nature of the actual, underlying error is?
Do you have any guidance how to proceed here?
- Ngôn ngữ chính
- Python
- Star
- 1.5k
- Fork
- 787
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
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 robotframework/SeleniumLibrary
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
robotframework/SeleniumLibrary#1941 · 3 bình luận ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
robotframework/SeleniumLibrary#1833 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
robotframework/SeleniumLibrary#1436 · 5 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
robotframework/SeleniumLibrary#1993 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
robotframework/SeleniumLibrary#1992 · 4 bình luận ·
Tất cả issue của robotframework/SeleniumLibrary
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
qgis/QGIS-Documentation#11275 ·
-
bug priority:normal ready-for-dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
OpenHands/extensions#626 · 1 bình luận ·
-
Change observation tooltip text Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
CSCfi/sd-search-api#39 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
please add to porn list Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
StevenBlack/hosts#3255 ·