Repository: elebumm/RedditVideoMakerBot

Issue #1971: Timeout 30000ms exceeded even after new UI layout when taking screenshots
Created: 2024-02-28T10:02:32Z
Describe the bug
When the bot tries to take screenshots of individual comments, it times out.
Reproduction Steps
After updating to code relevant for the new UI, it worked yesterday however, today it seems to be stuck on taking screenshots and chromium freezes
Expected behavior

The bot to take screenshots of all the comments
compile the video

Screenshots

  File "/Users/mikko/Developer/RedditVideoMakerBot/main.py", line 132, in <module>
    raise err
  File "/Users/mikko/Developer/RedditVideoMakerBot/main.py", line 111, in <module>
    main(post_id)
  File "/Users/mikko/Developer/RedditVideoMakerBot/main.py", line 53, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "/Users/mikko/Developer/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line 266, in get_screenshots_of_reddit_posts
    page.locator(f"#t1_{comment['comment_id']}-comment-rtjson-content").screenshot(
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 17568, in screenshot
    self._sync(
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 109, in _sync
    return task.result()
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 529, in screenshot
    return await self._with_element(
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 115, in _with_element
    handle = await self.element_handle(timeout=timeout)
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 315, in element_handle
    handle = await self._frame.wait_for_selector(
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 322, in wait_for_selector
    await self._channel.send("waitForSelector", locals_to_params(locals()))
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 61, in send
    return await self._connection.wrap_api_call(
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 482, in wrap_api_call
    return await cb()
  File "/Users/mikko/Developer/RedditVideoMakerBot/venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 97, in inner_send
    result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for locator("#t1_ksf1z8o-comment-rtjson-content")
============================================================
╭──────────────────────────────────────────────────────────────────────────────╮
│ Sorry, something went wrong with this version! Try again, and feel free to   │
│ report this issue at GitHub or the Discord community.                        │
│ Version: 3.2.1                                                               │
│ Error: Timeout 30000ms exceeded.                                             │
│ =========================== logs ===========================                 │
│ waiting for locator("#t1_ksf1z8o-comment-rtjson-content")                    │
│ ============================================================                 │
│ Config: {'allow_nsfw': False, 'theme': 'light', 'times_to_run': 10,          │
│ 'opacity': 0.9, 'storymode': False, 'storymodemethod': 1,                    │
│ 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h': 1920,    │
│ 'zoom': 1.0, 'background': {'background_video': 'minecraft',                 │
│ 'background_audio': 'lofi', 'background_audio_volume': 0.03,                 │
│ 'enable_extra_audio': False, 'background_thumbnail': True,                   │
│ 'background_thumbnail_font_family': 'arial',                                 │
│ 'background_thumbnail_font_size': 96, 'background_thumbnail_font_color':     │
│ '255,255,255'}, 'tts': {'voice_choice': 'tiktok', 'random_voice': False,     │
│ 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED',          │
│ 'aws_polly_voice': 'Matthew', 'streamlabs_polly_voice': 'Matthew',           │
│ 'tiktok_voice': 'en_us_001', 'tiktok_sessionid': 'REDACTED', 'python_voice': │
│ '1', 'py_voice_num': '2', 'silence_duration': 0.3, 'no_emojis': False}}      │
╰──────────────────────────────────────────────────────────────────────────────╯


System Information
Operating System : MacOS
Python version : Python 3.10
App version / Branch : Pycharm
Checklist

 I have searched the open issues for duplicates.
 I have shown the entire traceback, if possible.

Additional Context
No response

Duplicate issue #2065: [Bug]: waiting for locator("[data-test-id=\"post-content\"]")
Created: 2024-06-06T15:23:25Z
Describe the bug
When I try to capture the screen I get this error
Reproduction Steps
Sorry, something went wrong with this version! Try again, and feel free to report this issue at GitHub or the        │
│ Discord community.                                                                                                   │
│ Version: 3.2.1                                                                                                       │
│ Error: Timeout 30000ms exceeded.                                                                                     │
│ =========================== logs ===========================                                                         │
│ waiting for locator("[data-test-id="post-content"]")                                                               │
│ ============================================================                                                         │
│ Config: {'allow_nsfw': False, 'theme': 'dark', 'times_to_run': 1, 'opacity': 0.9, 'storymode': False,                │
│ 'storymodemethod': 1, 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0,         │
│ 'background': {'background_video': 'minecraft', 'background_audio': 'lofi', 'background_audio_volume': 0.15,         │
│ 'enable_extra_audio': False, 'background_thumbnail': False, 'background_thumbnail_font_family': 'arial',             │
│ 'background_thumbnail_font_size': 96, 'background_thumbnail_font_color': '255,255,255'}, 'tts': {'voice_choice':     │
│ 'tiktok', 'random_voice': True, 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED',                  │
│ 'aws_polly_voice': 'Matthew', 'streamlabs_polly_voice': 'Matthew', 'tiktok_voice': 'en_us_001', 'tiktok_sessionid':  │
│ 'REDACTED', 'python_voice': '1', 'py_voice_num': '2', 'silence_duration': 0.3, 'no_emojis': False}}                  │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\main.py", line 132, in 
raise err
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\main.py", line 114, in 
run_many(config["settings"]["times_to_run"])
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\main.py", line 69, in run_many
main()
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\main.py", line 53, in main
get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\video_creation\screenshot_downloader.py", line 219, in get_screenshots_of_reddit_posts
raise e
File "C:\Users\mayco\Downloads\RedditVideoMakerBot-3.2.1\video_creation\screenshot_downloader.py", line 201, in get_screenshots_of_reddit_posts
page.locator('[data-test-id="post-content"]').screenshot(path=postcontentpath)
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\sync_api_generated.py", line 17568, in screenshot
self._sync(
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_sync_base.py", line 109, in _sync
return task.result()
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_locator.py", line 529, in screenshot
return await self._with_element(
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_locator.py", line 115, in _with_element
handle = await self.element_handle(timeout=timeout)
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_locator.py", line 315, in element_handle
handle = await self._frame.wait_for_selector(
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_frame.py", line 322, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_connection.py", line 61, in send
return await self._connection.wrap_api_call(
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_connection.py", line 482, in wrap_api_call
return await cb()
File "C:\Users\mayco\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright_impl_connection.py", line 97, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.
=========================== logs ===========================
waiting for locator("[data-test-id="post-content"]")
Expected behavior
Could someone help me
Screenshots
No response
System Information
Operating System : [e.g. Windows 10]
Python version : [e.g. Python 3.6]
App version / Branch : [e.g. latest, V2.0, master, develop]
Checklist

 I have searched the open issues for duplicates.
 I have shown the entire traceback, if possible.

Additional Context
No response

Closing comment (2024-06-16T20:22:04Z): duplicate of #1971