how to use Web_add_cookie () and web_add_header () function in vugen..

  • Questions
  • how to use Web_add_cookie () and web_add_header () function in vugen..
Question ID: 108227
0
0

Hi, can anyone update me with proper use of Web_add_cookie () and web_add_header () function.
for ex – web_add_cookie ("_GA 2332438567430454 766765 ; domain=abc.com");
so in abov exp, how to identify the exact cookie value, appearing in parenthese. and how we can use web_add_header () function in vugen scripting.

Marked as spam
Posted by (Questions: 9, Answers: 0)
Asked on April 12, 2018 10:54 am
2252 views
Answers (1)
0
Private answer

According to Micro Focus

**- Web_add_cookie ()**

The web_add_cookie function adds a new cookie. If the name and path match an existing cookie, the existing cookie is overwritten with the new one. If the ''expires'' date has past, the cookie is deleted.
Although scripts handle cookies automatically, there may be cases when you need to manually control the cookies.

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

The intended use of web_add_cookie is to add cookies usually stored in the browser, prior to starting the run.

Note that in a Set-Cookie header from a server, the domain attribute is optional. If not specified, the default value of domain is the host name of the server that generated the cookie response. Since this information is not available to the load generator host when web_add_cookie is called, the domain attribute is required. To specify an empty domain, use web_add_cookie_ex..
This function is supported for all Web scripts.

- **web_add_header ()**

The web_add_header function is a service function that adds a user-defined header to the next HTTP request.

Web scripts automatically send standard headers with each HTTP request they submit. You can define additional user-defined headers from the Advanced tab in the Recording Options dialog box in VuGen. When you enable headers from the Recording Options, VuGen generates a web_add_header function with the specified headers. It is recorded only when the recording headers option is enabled (see VuGen's Recording Advanced Options).

When two consecutive steps require headers, the web_add_auto_header function is generated automatically. You can also manually add the web_add_auto_header function to your script. The advantage of using web_add_auto_header is that it applies to all HTTP requests that follow, unlike web_add_header, which only applies to the HTTP request that follows it.

One common use of user-defined headers is to add user agent information. User agent information is often used for statistical purposes, for tracing of protocol violations, and for automated recognition of user agents for the sake of tailoring responses to avoid particular user agent limitations, such as inability to support HTML tables.

This function is supported for all Web scripts. This function may be used in concurrent groups.

Note: This function ignores web_rest (or web.rest) steps which send REST API requests.

Marked as spam
Posted by (Questions: 12, Answers: 378)
Answered on July 9, 2018 4:44 pm