As you can see between user and web server there are mainly 2 layers:
Layer 1 is where user interacts with the browser by e.g. clicking a button, selecting values from the list or submitting a form
Layer 2 is where browser communicates with web server which includes:
creating and sending HTTP requests to the web server based on user’s actions
receiving HTTP responses from the web server
rendering HTTP responses, forming an UI and displaying it to the user
Below I’m providing two scripts that do exactly the same thing but in slightly different way. The goal for each script is to search for a “linux” word using google search.
First, lets look at “Web (HTTP/HTML)” type of the script:
Action()
{
web_url("www.google.com",
"URL=http://www.google.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_think_time(6);
web_url("search",
"URL=http://www.google.co.uk/search?hl=en&source=hp&q=linux&btnG=Google+Search&meta=&aq=f&oq=",
"Resource=0",
"RecContentType=text/html",
"Referer=http://www.google.co.uk/",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);
return 0;
}
What happens here?
In line 3 we are entering google.com web site
In line 14 we are sending HTTP request that browser would generate after searching for value “linux”
Now, lets look at “Web (Click and Script)” type of the script:
Action()
{
web_browser("www.google.com",
DESCRIPTION,
ACTION,
"Navigate=http://www.google.com/",
LAST);
web_edit_field("q",
"Snapshot=t1.inf",
DESCRIPTION,
"Type=text",
"Name=q",
ACTION,
"SetValue=linux",
LAST);
web_button("INPUT",
"Snapshot=t2.inf",
DESCRIPTION,
"Type=submit",
"Tag=INPUT",
"ID=",
"Value=Google Search",
ACTION,
"UserAction=Click",
LAST);
return 0;
}
In line 4 we are entering google.com web site
In line 10 we are typing value “linux” into the input field
In line 19 we are clicking “Google Search” button that will move us to the page with search results
So what is the difference between these two scripts?
First script operates on much lover level comparing to second script. It deals with HTTP requests without taking care about what actions user actually performs. It doesn’t care how fast user’s browser renders and display the UI. It only checks how fast web server is able to response with correct message.
Second script operates only on UI level without taking care what happens underneath. Response time here includes not only time needed to send/receive HTTP traffic but also time needed to form/display UI to the user.
Basically second script approach is less error prone because you don’t have to deal with low level things like HTTP parameters. And You are replicating user’s actions in a natural way.
So if you need to choose, then I would recommend Web Click and Script type of the script.