Loadrunnber 报错误:Error -- memory violation : Exception ACCESS_VIOLATION received.的一种情况

时间:2022-06-01 20:33:46

最近写的一个Loadrunner脚本,最后一步是点击“退出”按钮退出登录状态,如下:

web_text_link("[退出]",
    "Snapshot=t18.inf",
    DESCRIPTION,
    "Text=[退出]",
    ACTION,
    "UserAction=Click",
    LAST);
return 0;

但是会报错误:

Action1.c(94): Error: C interpreter run time error: Action1.c (94):  Error -- memory violation : Exception ACCESS_VIOLATION received.
Action1.c(94): Notify: CCI trace: Action1.c(94): web_text_link(0x02080870, 0x0208085f "Snapshot=t18.inf", 0x02080a42 "DESCRIPTION", 0x02080853, 0x02080a3b "ACTION", 0x020809de "UserAction=Click", 0x02080a6a "LAST")
.
Action1.c(94): Notify: CCI trace: Compiled_code(0): Action1()
.

经过试验,发现是因为 退出后有个自动跳转。

如果退出结束代码修改为下面就没有问题了。

    web_text_link("[退出]",
        "Snapshot=t18.inf",
        DESCRIPTION,
        "Text=[退出]",
        ACTION,
        "UserAction=Click",
        LAST);
    web_browser("Sync",
        "Snapshot=t18.inf",
        DESCRIPTION,
        ACTION,
        "Sync",
        LAST);
     return 0;

结论:

web_text_link 如果有中间跳转,不能放在代码的最后,最后要有一个 Sync 。