Traceback (most recent call last): File "d:\A 实训\shixun10\震坤行.py", line 60, 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 52, in main await page.click('//*[@id="J_bottomPage"]/span/a') File "C:\Python311\Lib\site-packages\pyppeteer\page.py", line 1475, in click await frame.click(selector, options, **kwargs) File "C:\Python311\Lib\site-packages\pyppeteer\frame_manager.py", line 581, in click handle = await self.J(selector) ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pyppeteer\frame_manager.py", line 317, in querySelector value = await document.querySelector(selector) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python311\Lib\site-packages\pyppeteer\element_handle.py", line 358, in querySelector handle = await self.executionContext.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 'querySelector' on 'Document': '//*[@id="J_bottomPage"]/span/a' is not a valid selector. at <anonymous>:1:33
时间: 2023-08-03 14:07:01 浏览: 272
Mac下anaconda中Spyder打开报错Traceback(most recent call last)…问题
5星 · 资源好评率100%
这段 Traceback 是 Python 在执行某个程序时遇到的错误信息。从错误信息可以看出,程序在执行 `page.click` 方法时传入了一个无效的选择器字符串 `'//*[@id="J_bottomPage"]/span/a'`,导致无法找到对应的元素,从而抛出了 DOMException 异常。
可能的原因是该页面上没有符合该选择器的元素,或者该选择器本身存在语法错误。建议检查一下页面上是否存在该元素,或者尝试使用其他有效的选择器。你也可以在 Chrome 浏览器的开发者工具中使用选择器来调试,确认选择器是否正确。
阅读全文