NotImplementedError

在使用playwright时报NotImplementedError错误,是怎么回事啊

代码:

        js = """
        Object.defineProperties(navigator, {webdriver:{get:()=>undefined}});
        """
        with sync_playwright() as playwright:
            browser = playwright.chromium.launch(headless=False)
            context = browser.new_context(
                storage_state='state.json')  # storage_state='state.json'
            page = context.new_page()
            page.add_init_script(js)
            page.goto(url)
 
            page.wait_for_timeout(2000)

报错信息:

[2024-07-30 14:22:24][asyncio.default_exception_handler():1707] [ERROR] Future exception was never retrieved
future: <Future finished exception=NotImplementedError()>
Traceback (most recent call last):
  File "D:\2.py", line 110, in run
    self.main(i.old_title)
  File "D:\2.py", line 38, in main
    html_text = self.captcha.run(url_)
  File "D:\auto_pw.py", line 392, in run
    with sync_playwright() as playwright:
  File "D:\admin\.venv\lib\site-packages\playwright\sync_api\_context_manager.py", line 77, in __enter__
    dispatcher_fiber.switch()
  File "D:\admin\.venv\lib\site-packages\playwright\sync_api\_context_manager.py", line 56, in greenlet_main
    self._loop.run_until_complete(self._connection.run_as_sync())
  File "D:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
    return future.result()
  File "D:\admin\.venv\lib\site-packages\playwright\_impl\_connection.py", line 263, in run_as_sync
    await self.run()
  File "D:\django-vue-admin\.venv\lib\site-packages\playwright\_impl\_connection.py", line 272, in run
    await self._transport.connect()
  File "D:\admin\.venv\lib\site-packages\playwright\_impl\_transport.py", line 133, in connect
    raise exc
  File "D:\admin\.venv\lib\site-packages\playwright\_impl\_transport.py", line 120, in connect
    self._proc = await asyncio.create_subprocess_exec(
  File "D:\Program Files\Python38\lib\asyncio\subprocess.py", line 236, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
  File "D:\Program Files\Python38\lib\asyncio\base_events.py", line 1630, in subprocess_exec
    transport = await self._make_subprocess_transport(
  File "D:\Program Files\Python38\lib\asyncio\base_events.py", line 491, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值