Python selenium错误处理

2024-09-29 01:34:54 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个python selenium脚本,它通过这样的循环运行。。。

for i, refcode in enumerate(refcode_list):

    try:
        source_checkrefcode()
    except TimeoutException:
        pass
        csvWriter.writerow([refcode, 'error', timestamp])

如果在源代码检查期间出现问题,则脚本将崩溃并出现错误。

如何将错误处理添加到此循环,以便它只移动到下一个项目而不是崩溃?


Tags: in脚本sourceforseleniumpasslisttry