Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "C:\Users\Toenc\Anaconda3\envs\tensorflow\lib\site-packages\pyppeteer\launcher.py", line 217, in killChrome
self._cleanup_tmp_user_data_dir()
File "C:\Users\Toenc\Anaconda3\envs\tensorflow\lib\site-packages\pyppeteer\launcher.py", line 133, in _cleanup_tmp_user_data_dir
raise IOError('Unable to remove Temporary User Data')
OSError: Unable to remove Temporary User Data
进行修改过的代码
import pyppeteer
import asyncio
from pyppeteer import launch
async def main():
# 使用launch方法调用浏览器,其参数可以传递关键字参数也可以传递字典。
browser = await launch({'headless': False,"userDataDir":"C:/tool/pyppeteer", 'args': ['--disable-infobars', '--window-size=1920,1080', '--no-sandbox']})
# 打开一个页面
page = await browser.newPage()
await page.setViewport({'width': 1920, 'height': 1080}) # 设置页面的大小
# 打开链接
await page.goto('https://kamisamak.com/')
# 调用
asyncio.get_event_loop().run_until_complete(main())
文章评论
:yi: