-
-
Notifications
You must be signed in to change notification settings - Fork 334
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Checklist before requesting
- I have searched for similar feature requests and didn't find a duplicate.
- I have checked the documentation to confirm this feature doesn't already exist.
Problem Statement
Image file rendering errors (such as holes and strange lines) occur, which are the same as obtaining the function of screenshot base64 and saving the screenshot image. This problem usually occurs on machines with weak performance, and I don't think it is a bug.
Proposed Solution
You don't need a new method, you need to modify the function to get screenshots.
Alternatives Considered
Consider using the command to generate the screenshot file and then read it asynchronously. This error will not occur when using the command to generate it.
Additional Context
This problem is almost impossible on a machine with good performance.
import asyncio
from pydoll.browser.chrome import Chrome
from pydoll.browser.options import Options
async def main():
options = Options()
options.add_argument("--headless") # 启用无头模式
options.add_argument("--disable-gpu") # 禁用GPU加速
options.add_argument("--no-sandbox") # 禁用沙盒模式
#options.add_argument("--disable-dev-shm-usage") # 禁用共享内存
options.add_argument("--window-size=1920x1080") # 设置窗口大小
options.binary_location = '/usr/bin/chromium' # 设置Chromium的路径
async with Chrome(options=options) as browser:
await browser.start()
page = await browser.get_page()
await page.go_to('https://example.com')
# 增加等待时间
await asyncio.sleep(6)
# 获取截图
p = await page.get_screenshot_base64()
print(p)
asyncio.run(main())
I find it much better to wait a few seconds.
Importance
Nice to have
Contribution
None
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request

