问个关于python异常的小问题:
pyCharm给出的异常信息中,那个才是异常的“名字”,就是说,在except后,冒号前,夹着的那个“错误名称”
报错信息如下
```python
Traceback (most recent call last):
File "E:/jzf/202210hesuan/main.py", line 124, in <module>
hesuan_date = a.find_element(By.XPATH,'./div/nz-card/div[2]/nz-card[2]/div[2]/nz-card/div/div[8]/span[2]').text
File "D:\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 84, in text
return self._execute(Command.GET_ELEMENT_TEXT)['value']
File "D:\Python38\lib\site-packages\selenium\webdriver\remote\webelement.py", line 396, in _execute
return self._parent.execute(command, params)
File "D:\Python38\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 435, in execute
self.error_handler.check_response(response)
File "D:\Python38\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 247, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document
(Session info: chrome=106.0.5249.91)
Stacktrace:
Backtrace:
Ordinal0 [0x013D1ED3+2236115]
Ordinal0 [0x013692F1+1807089]
Ordinal0 [0x012766FD+812797]
......
那我应该用
selenium.common.exceptions.StaleElementReferenceException
还是Message
还是stale element reference
还是element is not attached to the page document
呢?
望不吝赐教,谢谢