0

playwright で以下のサンプルとしてコードを書きました。コードを実行すると、失敗した 2:10 の比率。クリック イベントが発生せず、エラーが発生します。

クリックイベントがpage.click('text=Place Order') またはに変更されましたpage.click('div[title="Place Order"]']

このエラーの解決策を教えてください。

以下のサンプルコード。

 page.click('button#place_order')
 page.wait_for_url('**/order-received**')

以下のエラーの詳細。

Traceback (most recent call last):
  File "d:\xcodes\FilesDone\helium_playwright\playwright_basev2.0.py", line 65, in <module>
    playwright_sample(url)
  File "d:\xcodes\FilesDone\helium_playwright\playwright_basev2.0.py", line 43, in playwright_sample
    page.wait_for_url('**/order-received**')
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\sync_api\_generated.py", line 7412, in wait_for_url
    self._sync(
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\_impl\_sync_base.py", line 111, in _sync
    return task.result()
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\_impl\_page.py", line 490, in wait_for_url
    return await self._main_frame.wait_for_url(**locals_to_params(locals()))
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\_impl\_frame.py", line 204, in wait_for_url
    async with self.expect_navigation(
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\_impl\_event_context_manager.py", line 33, in __aexit__
    await self._future
  File "C:\Users\**\Programs\Python\Python310\lib\site-packages\playwright\_impl\_frame.py", line 180, in continuation
    event = await wait_helper.result()
playwright._impl._api_types.TimeoutError: Timeout 30000.0ms exceeded.
=========================== logs ===========================
waiting for navigation to "**/order-received**" until 'load'
============================================================
Exception ignored in: <function BaseSubprocessTransport.__del__ at 0x000001EC9DB3DA20>
Traceback (most recent call last):
  File "C:\Users\**\Programs\Python\Python310\lib\asyncio\base_subprocess.py", line 126, in __del__
  File "C:\Users\**\Programs\Python\Python310\lib\asyncio\base_subprocess.py", line 104, in close
  File "C:\Users\**\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
  File "C:\Users\**\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
  File "C:\Users\**\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
4

1 に答える 1