Selenium返回错误,但没有关于错误的详细信息,如何识别错误?

k10s72fa  于 2022-12-13  发布在  其他
关注(0)|答案(1)|浏览(269)

当我运行我的Selenium/Python脚本时,它显示了以下错误,其中没有附加典型的错误信息(即NoSuchElementException,...)。

**Stacktrace:
Backtrace:
Ordinal0 [0x0045ACD3+2075859]
Ordinal0 [0x003EEE61+1633889]
Ordinal0 [0x002EB7BD+571325]
Ordinal0 [0x0031AC2F+764975]
Ordinal0 [0x0031AE1B+765467]
Ordinal0 [0x0034D0F2+970994]
Ordinal0 [0x00337364+881508]
Ordinal0 [0x0034B56A+963946]
Ordinal0 [0x00337136+880950]
Ordinal0 [0x0030FEFD+720637]
Ordinal0 [0x00310F3F+724799]
GetHandleVerifier [0x0070EED2+2769538]
GetHandleVerifier [0x00700D95+2711877]
GetHandleVerifier [0x004EA03A+521194]
GetHandleVerifier [0x004E8DA0+516432]
Ordinal0 [0x003F682C+1665068]
Ordinal0 [0x003FB128+1683752]
Ordinal0 [0x003FB215+1683989]
Ordinal0 [0x00406484+1729668]
BaseThreadInitThunk [0x76316939+25]
RtlGetFullPathName_UEx [0x77C98FD2+1218]
RtlGetFullPathName_UEx [0x77C98F9D+1165]**

我用

try:
   #code goes here
except Exception as e:
   print(str(s))

当ordirar try/except没有太大帮助时,如何检测错误发生的位置和原因?

sycxhyv7

sycxhyv71#

捕获错误的一种方法是:

try:
   #code goes here
except Exception as e:
   error_msg = ''.join(traceback.format_exception(type(e), e, e.__traceback__))
   print(error_msg)

danny_dare在feverr(https://www.fiverr.com/danny_dare)上获得了学分

相关问题