Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Review `Handle Alert when popup window closes` test

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
停滞
技術スタック
python
領域
testing-qa

調査の方向性

「Handle Alert when popup window closes」受け入れテストから始め、リンクされた GitHub Actions の実行における成功ログと失敗ログを比較します。次に、src/SeleniumLibrary/keywords/alert.py の alert 処理パス、特に _handle_alert と _wait_alert を調査します。完了とは、報告されたウィンドウまたは alert の失敗がなく、テスト結果が一貫していて理解できる状態です。

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

説明

In running the acceptance test for a recent pull request we received varying results on the Handle Alert when popup window closes test case.

When it fails the following trace loglevel is shown

<html>
<body>
<!--StartFragment-->

10:22:53.373 | INFO | HANDLE::<class 'datetime.timedelta'>::0:00:10 |  
-- | -- | -- | --


<!--EndFragment-->
</body>
</html>10:22:53.373	INFO	HANDLE::<class 'datetime.timedelta'>::0:00:10	
10:22:53.373	DEBUG	GET http://localhost:46269/session/59f81e650237aeb4b439252651ba8358/alert/text {}	
10:22:53.379	DEBUG	http://localhost:46269/ "GET /session/59f81e650237aeb4b439252651ba8358/alert/text HTTP/1.1" 404 747	
10:22:53.380	DEBUG	Remote response: status=404 | data={"value":{"error":"no such alert","message":"no such alert\n  (Session info: headless chrome=112.0.5615.165)","stacktrace":"#0 0x55f5ce88dfe3 \u003Cunknown>\n#1 0x55f5ce5ccbc1 \u003Cunknown>\n#2 0x55f5ce5c0b41 \u003Cunknown>\n#3 0x55f5ce5e4279 \u003Cunknown>\n#4 0x55f5ce62a91b \u003Cunknown>\n#5 0x55f5ce5e40ee \u003Cunknown>\n#6 0x55f5ce62a693 \u003Cunknown>\n#7 0x55f5ce5fd03a \u003Cunknown>\n#8 0x55f5ce5fe17e \u003Cunknown>\n#9 0x55f5ce84fdbd \u003Cunknown>\n#10 0x55f5ce853c6c \u003Cunknown>\n#11 0x55f5ce85d4b0 \u003Cunknown>\n#12 0x55f5ce854d63 \u003Cunknown>\n#13 0x55f5ce827c35 \u003Cunknown>\n#14 0x55f5ce878138 \u003Cunknown>\n#15 0x55f5ce8782c7 \u003Cunknown>\n#16 0x55f5ce886093 \u003Cunknown>\n#17 0x7fec88957b43 \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '747', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
10:22:53.380	DEBUG	Finished Request	
10:22:53.881	DEBUG	GET http://localhost:46269/session/59f81e650237aeb4b439252651ba8358/alert/text {}	
10:22:53.893	DEBUG	http://localhost:46269/ "GET /session/59f81e650237aeb4b439252651ba8358/alert/text HTTP/1.1" 200 14	
10:22:53.894	DEBUG	Remote response: status=200 | data={"value":null} | headers=HTTPHeaderDict({'Content-Length': '14', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
10:22:53.895	DEBUG	Finished Request	
10:22:53.895	DEBUG	GET http://localhost:46269/session/59f81e650237aeb4b439252651ba8358/alert/text {}	
10:22:53.897	DEBUG	http://localhost:46269/ "GET /session/59f81e650237aeb4b439252651ba8358/alert/text HTTP/1.1" 404 784	
10:22:53.898	DEBUG	Remote response: status=404 | data={"value":{"error":"no such window","message":"no such window: target window already closed\nfrom unknown error: web view not found\n  (Session info: headless chrome=112.0.5615.165)","stacktrace":"#0 0x55f5ce88dfe3 \u003Cunknown>\n#1 0x55f5ce5ccd36 \u003Cunknown>\n#2 0x55f5ce5a7b2c \u003Cunknown>\n#3 0x55f5ce62f83f \u003Cunknown>\n#4 0x55f5ce5e3ed1 \u003Cunknown>\n#5 0x55f5ce62a693 \u003Cunknown>\n#6 0x55f5ce5fd03a \u003Cunknown>\n#7 0x55f5ce5fe17e \u003Cunknown>\n#8 0x55f5ce84fdbd \u003Cunknown>\n#9 0x55f5ce853c6c \u003Cunknown>\n#10 0x55f5ce85d4b0 \u003Cunknown>\n#11 0x55f5ce854d63 \u003Cunknown>\n#12 0x55f5ce827c35 \u003Cunknown>\n#13 0x55f5ce878138 \u003Cunknown>\n#14 0x55f5ce8782c7 \u003Cunknown>\n#15 0x55f5ce886093 \u003Cunknown>\n#16 0x7fec88957b43 \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '784', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
10:22:53.898	DEBUG	Finished Request	
10:22:53.898	FAIL	NoSuchWindowException: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x55f5ce88dfe3 <unknown>
#1 0x55f5ce5ccd36 <unknown>
#2 0x55f5ce5a7b2c <unknown>
#3 0x55f5ce62f83f <unknown>
#4 0x55f5ce5e3ed1 <unknown>
#5 0x55f5ce62a693 <unknown>
#6 0x55f5ce5fd03a <unknown>
#7 0x55f5ce5fe17e <unknown>
#8 0x55f5ce84fdbd <unknown>
#9 0x55f5ce853c6c <unknown>
#10 0x55f5ce85d4b0 <unknown>
#11 0x55f5ce854d63 <unknown>
#12 0x55f5ce827c35 <unknown>
#13 0x55f5ce878138 <unknown>
#14 0x55f5ce8782c7 <unknown>
#15 0x55f5ce886093 <unknown>
#16 0x7fec88957b43 <unknown>
10:22:53.899	DEBUG	Traceback (most recent call last):
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/__init__.py", line 513, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/robotlibcore.py", line 122, in run_keyword
    return self.keywords[name](*args, **(kwargs or {}))
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/alert.py", line 131, in handle_alert
    return self._handle_alert(alert, action)
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/alert.py", line 135, in _handle_alert
    text = " ".join(alert.text.splitlines())
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/common/alert.py", line 59, in text
    return self.driver.execute(Command.W3C_GET_ALERT_TEXT)["value"]
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/browsermanagement.py", line 773, in execute
    result = self._base_execute(driver_command, params)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x55f5ce88dfe3 <unknown>
#1 0x55f5ce5ccd36 <unknown>
#2 0x55f5ce5a7b2c <unknown>
#3 0x55f5ce62f83f <unknown>
#4 0x55f5ce5e3ed1 <unknown>
#5 0x55f5ce62a693 <unknown>
#6 0x55f5ce5fd03a <unknown>
#7 0x55f5ce5fe17e <unknown>
#8 0x55f5ce84fdbd <unknown>
#9 0x55f5ce853c6c <unknown>
#10 0x55f5ce85d4b0 <unknown>
#11 0x55f5ce854d63 <unknown>
#12 0x55f5ce827c35 <unknown>
#13 0x55f5ce878138 <unknown>
#14 0x55f5ce8782c7 <unknown>
#15 0x55f5ce886093 <unknown>
#16 0x7fec88957b43 <unknown>

Where as when it pass we got the following

<html>
<body>
<!--StartFragment-->

Documentation: | Handles the current alert and returns its message.
-- | --
20230427 10:22:12.459 / 20230427 10:22:12.985 / 00:00:00.526

<!--EndFragment-->
</body>
</html>Documentation:	
Handles the current alert and returns its message.

Start / End / Elapsed:	20230427 10:22:12.459 / 20230427 10:22:12.985 / 00:00:00.526
10:22:12.460	INFO	HANDLE::<class 'datetime.timedelta'>::0:00:10	
10:22:12.460	DEBUG	GET http://localhost:46113/session/6bb6f29b435dcee71c2cb55ece3f2689/alert/text {}	
10:22:12.475	DEBUG	http://localhost:46113/ "GET /session/6bb6f29b435dcee71c2cb55ece3f2689/alert/text HTTP/1.1" 404 747	
10:22:12.476	DEBUG	Remote response: status=404 | data={"value":{"error":"no such alert","message":"no such alert\n  (Session info: headless chrome=112.0.5615.165)","stacktrace":"#0 0x556abadcdfe3 \u003Cunknown>\n#1 0x556abab0cbc1 \u003Cunknown>\n#2 0x556abab00b41 \u003Cunknown>\n#3 0x556abab24279 \u003Cunknown>\n#4 0x556abab6a91b \u003Cunknown>\n#5 0x556abab240ee \u003Cunknown>\n#6 0x556abab6a693 \u003Cunknown>\n#7 0x556abab3d03a \u003Cunknown>\n#8 0x556abab3e17e \u003Cunknown>\n#9 0x556abad8fdbd \u003Cunknown>\n#10 0x556abad93c6c \u003Cunknown>\n#11 0x556abad9d4b0 \u003Cunknown>\n#12 0x556abad94d63 \u003Cunknown>\n#13 0x556abad67c35 \u003Cunknown>\n#14 0x556abadb8138 \u003Cunknown>\n#15 0x556abadb82c7 \u003Cunknown>\n#16 0x556abadc6093 \u003Cunknown>\n#17 0x7f82165beb43 \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '747', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
10:22:12.476	DEBUG	Finished Request	
10:22:12.977	DEBUG	GET http://localhost:46113/session/6bb6f29b435dcee71c2cb55ece3f2689/alert/text {}	
10:22:12.981	DEBUG	http://localhost:46113/ "GET /session/6bb6f29b435dcee71c2cb55ece3f2689/alert/text HTTP/1.1" 404 784	
10:22:12.982	DEBUG	Remote response: status=404 | data={"value":{"error":"no such window","message":"no such window: target window already closed\nfrom unknown error: web view not found\n  (Session info: headless chrome=112.0.5615.165)","stacktrace":"#0 0x556abadcdfe3 \u003Cunknown>\n#1 0x556abab0cd36 \u003Cunknown>\n#2 0x556abaae7b2c \u003Cunknown>\n#3 0x556abab6f83f \u003Cunknown>\n#4 0x556abab23ed1 \u003Cunknown>\n#5 0x556abab6a693 \u003Cunknown>\n#6 0x556abab3d03a \u003Cunknown>\n#7 0x556abab3e17e \u003Cunknown>\n#8 0x556abad8fdbd \u003Cunknown>\n#9 0x556abad93c6c \u003Cunknown>\n#10 0x556abad9d4b0 \u003Cunknown>\n#11 0x556abad94d63 \u003Cunknown>\n#12 0x556abad67c35 \u003Cunknown>\n#13 0x556abadb8138 \u003Cunknown>\n#14 0x556abadb82c7 \u003Cunknown>\n#15 0x556abadc6093 \u003Cunknown>\n#16 0x7f82165beb43 \u003Cunknown>\n"}} | headers=HTTPHeaderDict({'Content-Length': '784', 'Content-Type': 'application/json; charset=utf-8', 'cache-control': 'no-cache'})	
10:22:12.982	DEBUG	Finished Request	
10:22:12.983	FAIL	An exception occurred waiting for alert: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x556abadcdfe3 <unknown>
#1 0x556abab0cd36 <unknown>
#2 0x556abaae7b2c <unknown>
#3 0x556abab6f83f <unknown>
#4 0x556abab23ed1 <unknown>
#5 0x556abab6a693 <unknown>
#6 0x556abab3d03a <unknown>
#7 0x556abab3e17e <unknown>
#8 0x556abad8fdbd <unknown>
#9 0x556abad93c6c <unknown>
#10 0x556abad9d4b0 <unknown>
#11 0x556abad94d63 <unknown>
#12 0x556abad67c35 <unknown>
#13 0x556abadb8138 <unknown>
#14 0x556abadb82c7 <unknown>
#15 0x556abadc6093 <unknown>
#16 0x7f82165beb43 <unknown>
10:22:12.985	DEBUG	Traceback (most recent call last):
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/alert.py", line 148, in _wait_alert
    return wait.until(EC.alert_is_present())
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/support/wait.py", line 86, in until
    value = method(self._driver)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/support/expected_conditions.py", line 439, in _predicate
    return driver.switch_to.alert
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/remote/switch_to.py", line 55, in alert
    _ = alert.text
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/common/alert.py", line 59, in text
    return self.driver.execute(Command.W3C_GET_ALERT_TEXT)["value"]
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/browsermanagement.py", line 773, in execute
    result = self._base_execute(driver_command, params)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchWindowException: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x556abadcdfe3 <unknown>
#1 0x556abab0cd36 <unknown>
#2 0x556abaae7b2c <unknown>
#3 0x556abab6f83f <unknown>
#4 0x556abab23ed1 <unknown>
#5 0x556abab6a693 <unknown>
#6 0x556abab3d03a <unknown>
#7 0x556abab3e17e <unknown>
#8 0x556abad8fdbd <unknown>
#9 0x556abad93c6c <unknown>
#10 0x556abad9d4b0 <unknown>
#11 0x556abad94d63 <unknown>
#12 0x556abad67c35 <unknown>
#13 0x556abadb8138 <unknown>
#14 0x556abadb82c7 <unknown>
#15 0x556abadc6093 <unknown>
#16 0x7f82165beb43 <unknown>


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/__init__.py", line 513, in run_keyword
    return DynamicCore.run_keyword(self, name, args, kwargs)
  File "/opt/hostedtoolcache/PyPy/3.7.13/x64/site-packages/robotlibcore.py", line 122, in run_keyword
    return self.keywords[name](*args, **(kwargs or {}))
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/alert.py", line 130, in handle_alert
    alert = self._wait_alert(timeout)
  File "/home/runner/work/SeleniumLibrary/SeleniumLibrary/src/SeleniumLibrary/keywords/alert.py", line 152, in _wait_alert
    raise AssertionError(f"An exception occurred waiting for alert: {err}")
AssertionError: An exception occurred waiting for alert: Message: no such window: target window already closed
from unknown error: web view not found
  (Session info: headless chrome=112.0.5615.165)
Stacktrace:
#0 0x556abadcdfe3 <unknown>
#1 0x556abab0cd36 <unknown>
#2 0x556abaae7b2c <unknown>
#3 0x556abab6f83f <unknown>
#4 0x556abab23ed1 <unknown>
#5 0x556abab6a693 <unknown>
#6 0x556abab3d03a <unknown>
#7 0x556abab3e17e <unknown>
#8 0x556abad8fdbd <unknown>
#9 0x556abad93c6c <unknown>
#10 0x556abad9d4b0 <unknown>
#11 0x556abad94d63 <unknown>
#12 0x556abad67c35 <unknown>
#13 0x556abadb8138 <unknown>
#14 0x556abadb82c7 <unknown>
#15 0x556abadc6093 <unknown>
#16 0x7f82165beb43 <unknown>

Noting a couple of differences. First when it fails there seems to be a 200 response from the alert/text webdriver command. And then when it passes we see that the NoSuchWindow exception is thrown. This may be narrowed down to adding that exception to the handle alert code.

This is placeholder to look at strange results we are seeing with the acceptance tests.

主要言語
Python
スター
1.5k
フォーク
787
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

robotframework/SeleniumLibrary のほかの issue

robotframework/SeleniumLibrary の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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