Script Recording with different options of Advance setting
Advance Settings lets User Configure the browser settings for recording scripts. There are following advanced settings based on browser used for recording:
For Browser Options
- Browser type
- Clear cookie and cache
For Split page Options
- Page Split Time()
- Split Page Method
- HTTP Header
- User Event (For CType script recorded by NSBrowser)
For Netstorm Browser Only
- Javascript – Default is Enabled
- Image Download – Default is Enabled
- Plugins – Default is Enabled
- Delete Cookies – Always checked
- Ignore Https Certificate Warnings – Always Checked
- Snapshot Capturing – Default is Enabled and Checked
- PreSnapshot Capturing – Default is Enabled and Checked
- User Agent String – default value is “Mozilla/4.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.24) Gecko/20111103 Firefox/3.6.24”.
Recording with Options for NS Browser
In Netstorm Browser options, user agent text box contain default User Agent.
In split page options one more option is added to split page on user click event and it is enable only for Netstorm browser recording.
Time span in split page options changed into check box (Time difference of URL is more than) and text box for entering time limit is enable on checkbox selection.
Debugging Tips
User needs to follow the below mentioned debugging tips for script recording:
For Internet Explorer Browser
- HTTP Analyzer is required
- If IE version <=9 , then HTTP Analyzer 5.3.1 #25 is required
- If IE version >= 10 , then HTTP Analyzer 7.x is required
- Protected mode should be disabled.
For Mozilla Firefox Browser
- HTTP Analyzer is required
- If Mozilla Firefox version <=4 , then HTTP Analyzer 5.3.1 #25 is required
- If Mozilla Firefox version >=4 , then HTTP Analyzer 7.x is required
For NetStorm Browser
- Java 32 bit for Mozilla Engine
- Java 32/64 bit for Chromium Engine
When NS build is upgraded/downgraded, then clear the Java cache from control panel to open Script Manager GUI. Sometimes toolbars, such as ask/bingo interrupt HTTP Analyzer to capture request, so block such toolbars. Java Version 1.6 and later is required.
Protocol Buffer (protobuf)
NetStorm supports Protocol buffers, which are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data. It consists of two C-APIs:
- First API encodes the proto file and provides result in protobuf encoded format (binary).
- Second API decodes the response in normal text format.
In addition, protobuf (which provides some third party libraries to support Protocol buffers in NetStorm) is upgraded to version 3.0.0.
Key Features
There are following key features of protocol buffer in NetStorm:
- Provide NetStorm API to support encoding of the provided data into Google’s Protocol Buffer format. The data can be provided through C variable or NS parameter.
- Provide NetStorm API to support decoding of the provided data into Google’s Protocol Buffer format. The data can be provided through C variable or NS parameter.
- Provide support to encode ns_web_url() body into protocol buffer format. The body can be provided as XML file.
- Provide support to decode ns_web_url() response body from protocol buffer format to XML format.
- The user can parameterize XML’s node values.
- The user can view page dump of specific page.
- Protobuf supports in C-Type script (context switch and thread mode) and JAVA-type script.
- Protobuf encoding / decoding is supported in HTTP 2.0.
Script Configuration
The following CAPI is supported for Protobuf feature:
# | C-API | Short Description |
1 | ns_web_url() | Added new attribute to enable encoding/decoding of particular URL’s request and response body |
2 | ns_protobuf_encode() | This API encodes the proto file and give result in protobuf encoded format (binary) |
3 | ns_protobuf_decode() | This API decodes the response in normal text format. |
Script Description #include <stdio.h> #include <stdlib.h> #include <string.h> #include "ns_string.h" void flow() { ns_start_transaction("index_html"); ns_web_url ("index_html" "URL=http://10.10.30.41:9010/out.html", "HEADER=Accept-Language:en-in", "HEADER=Upgrade-Insecure-Requests:1", "HEADER=Content-Type:application/x-protobuf", "ReqProtoFile=data_2.proto", "ReqProtoMessageType=Address", "RespProtoFile=data_2.proto", "RespProtoMessageType=Address", "PreSnapshot=webpage_1556532582276.png", "Snapshot=webpage_1556532585393.png", "BODY=$CAVINCLUDE$=data_2.xml", INLINE_URLS, "URL=http://10.10.30.41:9010/tours/Merc10-dev/images/banner_animated.gif", "HEADER=Accept-Language:en-in", END_INLINE, "URL=http://10.10.30.41:9010/tours/Merc10-dev/images/sun_swede.gif", "HEADER=Accept-Language:en-in", END_INLINE, "URL=http://10.10.30.41:9010/tours/Merc10-dev/images/login.gif", "HEADER=Accept-Language:en-in", END_INLINE, "URL=http://10.10.30.41:9010/tours/images/banner_merctur.jpg", "HEADER=Accept-Language:en-in", END_INLINE ); ns_end_transaction("index_html", NS_AUTO_STATUS); ns_page_think_time(5.539);
Steps
- Run the above script from script management.
- Open page dump to validate whether req /rep body is encoded / decoded or not.
Screenshots
Parametrization Support
- The user can parameterize XML’s node value using NetStorm Parameterization feature.
- All parameters, which are supported in AMF, is also supported in Protobuf.
Example
Below is the proto file and XML file for parameterization support in protobuf:
Proto File syntax = "proto3"; message Address { optional string Recipient = 1; optional string House = 2; optional string Street = 3; optional string Town = 4; optional string County = 5; optional string PostCode = 6; optional string Country = 7; int32 id = 8; }
XML File
<Address> <Recipient>Cavisson</Recipient> <House>{S1v1}</House> //Node value can be parameterized <Street>FeatherstoneStreet</Street> <Town>LONDON</Town> <PostCode>EC1Y8SY</PostCode> <Country>UK</Country> <id>11</id> </Address>
registration.spec
nsl_static_var(S1v1:1, File=S1v1_data_file, Refresh=SESSION, Mode=SEQUENTIAL, FirstDataLine=1, EncodeMode=All);
S1v1_data_file Content
orig-v1-0 orig-v1-1 orig-v1-2 orig-v1-3 orig-v1-4 orig-v1-5 orig-v1-6 orig-v1-7 orig-v1-8 orig-v1-9
ns_protobuf_encode()
Synopsis
int ns_protobuf_encode(char *xml_data, int is_file_or_buffer, char *proto_fname, char *msg_type, char *enc_param)
Input
- xml_data: XML file name or xml data. It can be pass through NS parameter also.
- is_file_or_buffer: Flag to know whether xml_data field is xml file name or xml data
- xml file name
- xml data
- proto_fname: Proto file name to be encoded.
- msg_type: Message type of proto file
- enc_param: NS parameter in which encoded data will be stored.
Returns
It returns length of encoded buffer.
Example
len=ns_protobuf_encode("/home/cavisson/Controller_snehal/scripts/protobuf/protobuf/sahil/sahil.xml", 1, "/home/cavisson/Controller_snehal/scripts/protobuf/protobuf/sahil/proto_files/sahil.proto", "Test1", "param");
- len = returns length of encoded data
- 1st parameter = complete path of xml file
- 2nd parameter = flag to know whether 1st field is xml file name or xml data.
- 3rd parameter = complete path of proto file
- 4th parameter = message type of proto file
- 5th parameter = NS parameter in which encoded data will be stored
Example: Parameterization of XML Data
In flow file
Here, “xml_fname” is a NS parameter, which contains parameterized data.
Len = ns_protobuf_encode(“xml_fname”, 0, “/home/cavisson/Controller_snehal/scripts/protobuf/protobuf/sahil/proto_files/sahil.proto”, “Test1”, “param”);
In registration.spec
nsl_static_var(xml_fname, FILE=xml_fname.txt, Refresh=USE, Mode=SEQUENTIAL, VAR_VALUE=F1=file_param, FirstDataLine=1, EncodeMode=All);
Content of xml_fname.txt
/home/cavisson/work/scripts/protobuf/protobuf/sahil/document.xml
Content of document.xml:
<Address> <Recipient>Manish Mishra</Recipient> <House>{S1v1}</House> <Street>FeatherstoneStreet</Street> <Town>LONDON</Town> <PostCode>abcd</PostCode> <Country>1</Country> <id>12</id> </Address>
Here, in xml_fname NS parameter complete data will come after evaluating parameter used in the xml file.
ns_protobuf_decode()
Synopsis
ns_protobuf_decode(char *encoded_data_param, int len, int is_param, char *proto_fname, char *msg_type, char *decoded_param)
- encoded_data_param: NS parameter or buffer containing encoded data
- len: Length of encoded data
- is_param: Defines encoded_data_param field is NS parameter or a buffer
- proto_fname: Proto file name
- msg_type: Message type of proto
- decoded_data: NS parameter to store decoded data
Returns: No Return value
Example 1: Encoded data input is in NS parameter(body_param)
ns_protobuf_decode(“body_param”,len,1,”/home/cavisson/Controller_snehal/scripts/protobuf/protobuf/sahil/proto_files/sahil.proto”, “Test1”, “var”);
- 1st paramater = encoded data in NS parameter or buffer
- 2nd parameter = length of encoded data
- 3rd parameter = defines encoded_data is in NS parameter or buffer
- 4th parameter = protofile file name
- 5th parameter = message type of proto
- 6th parameter = NS parameter to store decoded data.
Example 2: Encoded data input is in buffer(body_param)
ns_protobuf_decode(body_param,len,0,”/home/cavisson/Controller_snehal/scripts/protobuf/protobuf/sahil/proto_files/sahil.proto”, “Test1”, “var”);
- 1st paramater = encoded data in NS parameter or buffer
- 2nd parameter = length of encoded data
- 3rd parameter = defines encoded_data is in NS parameter or buffer
- 4th parameter = protofile file name
- 5th parameter = message type of proto
- 6th parameter = NS parameter to store decoded data.
Screenshots