%%
Last Updated:
- [[2021-02-10]]
%%
## Using Silk Performer
### Getting percentile response time
```
MeasureCalculateRawPercentiles("UC_UL_01_Login_0010_HomePage", MEASURE_TIMER_RESPONSETIME);
```
### Error handling
Add this code before dcltrans to make the user perform certain actions upon encountering an error. Note: Ensure that the expected error code is not forced to transaction exit on error in the Active Profile settings.
```
dclevent
handler Handler1 <EVENT_RAISE_ERROR>
var
errMsg : String;
begin
print(psUsername + " encountered an error.\n");
errMsg := GetErrorMsg(GetLastError());
RaiseError(0,errMsg + ", " + GetFunctionName(),SEVERITY_ERROR);
return;
end Handler1;
```
### Merging different protocols in the same project
The best way to merge different protocols files is creating two different projects with appropriate protocol type.
- Record 2 different scripts and save it in their appropriate project.
- Open up the first project, and add the script that you’ve captured using the second project.
- To add an existing script, Right click in the Project Explorer and select ‘Add existing script’.
(especially for web and BDLT)
## Troubleshooting
### Clear Cache clears after every transaction
In one project, there was one user with bad data which was causing an error in one of the scripts. However, I noticed that when that user preceeded others, all the others also threw errors, despite them not throwing any errors when they preceeded the bad user. I suspected it was a caching issue, and including this code at the beginning of the transaction solved it:
```
WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);
WebSetDocumentCache(true, WEB_CACHE_CHECK_ALWAYS);
```
However, be aware that `WebSetUserBehavior(WEB_USERBEHAVIOR_FIRST_TIME);` removes the cache after every transaction. If this is done in `TInit`, `TMain` will fail every time!
The code below is a better alternative in this situation:
`WebBrowserReset();`