aahashemi / YouTubeAutomation-Reddit

GNU General Public License v3.0
218 stars 57 forks source link

Timing out on finding the post from reddit #8

Open N02744073 opened 1 year ago

N02744073 commented 1 year ago

Sometime I am getting this error when it times out and can't find the reddit post. It happens about 70% of the time

Traceback (most recent call last):
  File "/Users/amitozdeol/www/YouTubeAutomation-Reddit/main.py", line 112, in <module>
    main()
  File "/Users/amitozdeol/www/YouTubeAutomation-Reddit/main.py", line 37, in main
    get_screenshots_of_reddit_posts(reddit_thread=thread, reddit_comments=comments, screenshot_num=1)
  File "/Users/amitozdeol/www/YouTubeAutomation-Reddit/Graphics/screenshot.py", line 63, in get_screenshots_of_reddit_posts
    page.locator('[data-test-id="post-content"]').screenshot(path=postcontentpath)
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 16445, in screenshot
    self._sync(
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 104, in _sync
    return task.result()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 479, in screenshot
    return await self._with_element(
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 101, in _with_element
    handle = await self.element_handle(timeout=timeout)
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 285, in element_handle
    handle = await self._frame.wait_for_selector(
  File "/opt/homebrew/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 "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 44, in send
    return await self._connection.wrap_api_call(
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call
    return await cb()
  File "/opt/homebrew/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 79, 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\"]")
============================================================
nssharmaofficial commented 3 months ago

@N02744073 I fixed the issue. Check working solution here since this does not seem to be active.