如何在 HP LoadRunner 中将动态时间戳添加到 url?

How do I add a dynamic timestamp to a url in HP LoadRunner?

我想为 URL 参数 "time" 添加一个动态时间戳。如何应用当前时间戳而不是预定义的时间戳?

web_url("getSegment.php", 
    "URL=https://somesite.com/getSegment.php?purl=https%3A%2F%2Fstage.example.com%en%2F&jsref=&time=1455031236053", 
    "Resource=0", 
    "RecContentType=text/html", 
    "Referer=https://stage.example.com/en/", 
    "Snapshot=t3.inf", 
    "Mode=HTML", 
    LAST);

您可以使用lr_save_timestamp函数:

lr_save_timestamp("timestamp", LAST);
web_url("getSegment.php", 
    "URL=https://somesite.com/getSegment.php?purl=https%3A%2F%2Fstage.example.com%en%2F&jsref=&time={timestamp}",
    "Resource=0", 
    "RecContentType=text/html", 
    "Referer=https://stage.example.com/en/", 
    "Snapshot=t3.inf", 
    "Mode=HTML", 
    LAST);