Traceback (most recent call last): File "d:\A 实训\shixun10\震坤行.py", line 57, in <module> asyncio.get_event_loop().run_until_complete(main()) File "C:\Python311\Lib\asyncio\base_events.py", line 653, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "d:\A 实训\shixun10\震坤行.py", line 31, in main await page.waitForXPath('//*[@id="J_goodsList"]"]', {'timeout': 9000}) File "C:\Python311\Lib\site-packages\pyppeteer\frame_manager.py", line 853, in __await__ result = yield from self.promise ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pyppeteer\frame_manager.py", line 875, in rerun success = await context.evaluateHandle( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pyppeteer\execution_context.py", line 112, in evaluateHandle raise ElementHandleError('Evaluation failed: {}'.format( pyppeteer.errors.ElementHandleError: Evaluation failed: DOMException: Failed to execute 'evaluate' on 'Document': The string '//*[@id="J_goodsList"]"]' is not a valid XPath expression. at eval (eval at waitForPredicatePageFunction (:3:21), <anonymous>:6:20) at eval (eval at waitForPredicatePageFunction (:3:21), <anonymous>:24:10) at pollMutation (<anonymous>:18:31) at waitForPredicatePageFunction (<anonymous>:10:18)
时间: 2023-11-13 16:33:37 浏览: 66
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这是一个 Python 的错误信息,看起来是在使用 Pyppeteer 这个库时出现的问题。具体错误是在执行 `waitForXPath` 这个函数时,传入的 XPath 表达式不合法,导致无法执行。你需要检查一下这个 XPath 表达式 `//*[@id="J_goodsList"]"]` 是否正确,可能是多了一个引号导致的。
阅读全文