简体   繁体   中英

How to clear cookies in loadrunner 12.50

I am quite new to LoadRunner. I am using the 12.50 community edition and am using the protocol TruClient for web.

What should i do in order to delete the cookies that the LoadRunner has accumulated while doing interaction with browser?

As suggested by tserg42, you could add a separate step inside your "Develop Script" of TruClient for adding the "Utils.clearCookies()" command inside a Javascript action.

Please find the screenshots below for adding the above

Step 1

在此处输入图片说明

Drag the marked step on to the script

Step 2

在此处输入图片说明

Step 3

Upon clicking the "JS" icon at the right corner, the arguments editor would be available for providing javascript commands. Key in the required commands - "Utils.clearCookies()".

在此处输入图片说明


Additionally, you can also check "Simulate new user on each iteration" checkbox from Runtime Settings --> Replay --> Simulate new user on each iteration

在此处输入图片说明

You could try Utils.clearCookies() method. By the way, TruClient API documentation is available online .

I guess you are looking for the function web_cleanup_cookies() . Here is some relevant information I have found about its use:

Return Values

This function returns LR_PASS (0) on success and LR_FAIL (1) on failure.

General Information

The web_cleanup_cookies function removes all the cookies that are currently stored by the for use by the script.

Note : Scripts do not use (access or modify) the cookies that are stored by your browser. Instead, each Vuser uses the cookies that are sent to the Vuser by the server host at runtime. These cookies are maintained only while the script runs. The web-cookie functions ( web_add_cookie , web_remove_cookie and web_cleanup_cookies ) manipulate these temporary cookies, and do not affect cookies stored by your browser.

This function is supported for all Web scripts, and for WAP scripts running in HTTP or Wireless Session Protocol (WSP) replay mode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM