Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyppeteer.errors.ElementHandleError: Evaluation failed: TypeError: Cannot read property 'textContent' of null #8

Closed
Stvad opened this issue Apr 18, 2020 · 4 comments
Labels
bug Something isn't working question Further information is requested

Comments

@Stvad
Copy link

Stvad commented Apr 18, 2020

I've been running this every 10 min for the last day #4 This is an occasional error I observe

Downloading output of type markdown
Checking download type
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.2/x64/bin/roam-to-git", line 11, in <module>
    load_entry_point('roam-to-git==0.1', 'console_scripts', 'roam-to-git')()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/__main__.py", line 68, in main
    scrap(markdown_zip_path, json_zip_path, config)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 188, in scrap
    asyncio.get_event_loop().run_until_complete(asyncio.gather(*tasks))
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 107, in download_rr_archive
    button, button_text = await get_dropdown_button()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 101, in get_dropdown_button
    dropdown_button_text = await get_text(document, dropdown_button)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 25, in get_text
    text = await page.evaluate('(element) => element.textContent', b)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pyppeteer/page.py", line 1158, in evaluate
    return await frame.evaluate(pageFunction, *args, force_expr=force_expr)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pyppeteer/frame_manager.py", line 294, in evaluate
    return await context.evaluate(
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 54, in evaluate
    handle = await self.evaluateHandle(
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 113, in evaluateHandle
    raise ElementHandleError('Evaluation failed: {}'.format(
pyppeteer.errors.ElementHandleError: Evaluation failed: TypeError: Cannot read property 'textContent' of null
    at __pyppeteer_evaluation_script__:1:23
@MatthieuBizien
Copy link
Owner

I think it's because the interface can be slow. I've added a check in 5167bb8, does it "successfully fail" on assert dropdown_button is not None?

@Stvad
Copy link
Author

Stvad commented Apr 18, 2020

I'll observe it and let you know :) . #9 was making the export to consistently fail recently (though I think you recent commits helped with it)

@MatthieuBizien MatthieuBizien added bug Something isn't working question Further information is requested labels Apr 18, 2020
@Stvad
Copy link
Author

Stvad commented Apr 20, 2020

yeah, got an assertion error now

2020-04-20 03:34:03.093 | DEBUG    | roam_to_git.scrapping:download_rr_archive:79 - Closed browser json
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.8.2/x64/bin/roam-to-git", line 11, in <module>
    load_entry_point('roam-to-git==0.1', 'console_scripts', 'roam-to-git')()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/__main__.py", line 69, in main
    scrap(markdown_zip_path, json_zip_path, config)
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 253, in scrap
    asyncio.get_event_loop().run_until_complete(asyncio.gather(*tasks))
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 69, in download_rr_archive
    return await _download_rr_archive(document, output_type, output_directory, config,
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 146, in _download_rr_archive
    button, button_text = await get_dropdown_button()
  File "/opt/hostedtoolcache/Python/3.8.2/x64/lib/python3.8/site-packages/roam_to_git/scrapping.py", line 139, in get_dropdown_button
    assert dropdown_button is not None
AssertionError

@MatthieuBizien
Copy link
Owner

I think was issue is fixed, closing it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants