Performance testing in a specific browser - jmeter

I need to test the performance of a website in a specific browser (IE). Is it possible to do in Jmeter? Or is there any other tool that can do this?

Websites identify client browsers basing on User-Agent HTTP header so if you need to mimic IE browser just add HTTP Header Manager configured like:
Name: User-Agent
Value: the relevant User Agent string depending on which IE version you are trying to simulate, like for Internet Explorer 11 it would be
Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko
See Internet Explorer User Agent Strings for the full list.

JMeter doesn't actually "render" the page, it downloads response as plain text so you won't be able to detect any rendering time. It neither executes JavaScript.
links for reference:
https://guide.blazemeter.com/hc/en-us/articles/206733719-How-to-make-JMeter-behave-more-like-a-real-browser
https://www.blazemeter.com/blog/jmeter-webdriver-sampler

Related

How to record and create a JMX for an application only compatible in Microsoft Edge(Compatible mode IE5)

I have to do performance testing of an application only compatible in Microsoft Edge(Compatible mode IE5).Need to record the application and test in Jmeter.
Please help.
If you want to test the web application the main source for determining the client browser from its end is looking at User-Agent header.
So if you really need to mimic the 23-years-old-browser it's sufficient to send the relevant User-Agent using JMeter's HTTP Header Manager
Also you might be interested about the next funny fact: according to JMeter project main page
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
the same applicable to technologies like ActiveX or Flash or whatever else - you won't be simulate it in JMeter with 100% accuracy. The network footprint if any - yes, but no client-side impact.
The suggestion from Dmitri is valid.
You can set User-agent value to something relevant for the browser you want to simulate/fake.
Name = User-Agent
Value = Mozilla/4.0 (compatible; MSIE 5.0; Windows NT 5.1; Trident/4.0)
In JMeter this is available in HTTP Header Manager. This component controls the headers for all of the requests you send.
Regarding the recording, I think it is better to use HTTP request samplers to simulate all the requests you want.

jmeter - Authorization header goes missing

I have a fairly simple jmeter script for our site. As part of the flow through the site, I use our API in order to update the user's application.
The API uses OAuth authentication, which I'm familiar with using our own proprietary testing tool.
First I get a auth token via a call to our authorization endpoint. This returns a bit of JSON like this:
{"access_token":"a really long auth token string"}
In my script I use a regex to capture this token string. As part of investigating this problem, I've used a Debug PostProcessor to check that I get the correct string out, which I do. It's saved as variable 'authToken'.
In the very next step in the script, I add a header via a HTTP Header Manager, like so:
I know this header is correct as we have many instances of it in our API tests.
The relevant part of the script looks like this:
Each time I run the script however, the step that uses the token/header returns a 401 unauthorized.
I've tested the actual URL and header in a Chrome plugin and the call works as expected.
In the 'View Results Tree' listener, there is no evidence at all that the Authorization header is set at all. I've tried hard-coding an auth token but no joy - it still doesn't seem to be part of the request.
From the results tree, the request looks like this:
POST <correct URL>
POST data:{"id":"<item id>"}
Cookie Data: SessionProxyFilter_SessionId=<stuff>; sessionToken=<stuff>
Request Headers:
Content-Length: 52
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Connection: keep-alive
Content-Type: application/json
The results tree also shows no redirects.
I've tried the solutions here and here but neither of these worked.
Oddly, I'm almost certain that this worked about a month ago and as far as I can tell nothing has changed on the machine, in the script or with the jmeter installation. Obviously one of these is not true but I'm at my wit's end.
Another member of my team answered this for me and it's fairly simple. I just needed to set the 'Implementation' for the problem step to 'HttpClient4'.

How to identify when yammer is making a request for a page

In our ASP.NET code we look at the user-agent to perform statistics. Yes I know user-agent can be spoofed.
How can I identify when a web request for one of our pages comes from yammer? It doesn't appear the user agent is set to yammer.
If someone tries to share a link on yammer, the user agent that is set when the link is accessed is...
Mozilla/5.0 (compatible; Embedly/0.2; +http://support.embed.ly/)

MS Internet Explorer Request Aborted

I have a codeigniter webapp being accessed through https.
Everything works as expected in Firefox, Safari, Chrome and Opera. When using Internet Explorer (V11), about half the time, I get a page saying:
This page can’t be displayed
•Make sure the web address https://... is correct
...
When I look at the Developer Tools (F12), I see that the last request has Result (Aborted)
Localhost:
URL/test.php Result / (Aborted) ......... Initiator / navigate
URL/test.php Result / 200 ......... Initiator / click
sometimes the first request succeeds (200) and the second line doesn't appear
Internet Host:
URL/test.php Result / (Aborted) ......... Initiator / navigate
I never get the Initiator/click line when connecting to this host.
If I hit enter in the browser bar (initiator/navigate), I get result (Aborted) every second time.
If I repeat (press enter in the address bar again) it succeeds/fails/succeeds
However if I click reload or press F5 (initiator/refresh) it works every time.
If I leave a couple of minutes between requests (of whatever kind) it also works every time
I thought this had something to do with the cache. I tried to add extra headers
Pragma:no-cache
Cache-Control: no-cache, must-revalidate
Expires: Mon, 26 Jul 1997 05:00:00 GMT
It seems the hosted server setup has some kind of default configuration that excludes my Pragma/Cache-Control/Expires lines, as these do not appear in the response headers when the pages are served from the internet, but do from localhost
IE is reporting a different User-Agent String when connecting to my hosted server on the internet compared to localhost
Localhost:
Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.3; WOW64; Trident/7.0; .NET4.0E;
.NET4.0C; .NET CLR 3.5.30729; .NET CLR 2.0.50727; .NET CLR 3.0.30729;
AskTbFXTV5/5.9.1.14019)
Internet:
Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Any clues greatly appreciated
TIA.
I finally had the idea of clearing the browsing history.
This happened by coincidence as I was working on some .css changes at the time and those changes didn't seem to get reflected when reloading the page.
I cleared Temporary Internet files, Cookies and History. I assume clearing Temporary Internet files is what cured the problem.

Want to get html content of Microsoft Live Login page

I have url:
https://login.live.com/login.srf?wa=wsignin1.0&wtrealm=http%3a%2f%2fcorp.sts.microsoft.com&wctx=7b4cd04b-7dc2-4880-9f77-20c8c6ef64c4&wct=2013-03-11T06%3a54%3a42Z&whr=uri%3aWindowsLiveID.
I want to get htmlcotent of this webpage as string. My Code Looks like this.
WebClient wc = new WebClient();
string html = wc.DownloadString("url");
When I examine the content in html string I see an error message:
Microsoft account requires JavaScript to sign in. This web browser
either does not support JavaScript, or scripts are being blocked. To
find out whether your browser supports JavaScript, or to allow
scripts, see the browser's online help.
You could set the User-Agent request header to some know browser which will trick the website into thinking that it supports javascript:
using (WebClient wc = new WebClient())
{
client.Headers[HttpRequestHeader.UserAgent] = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.152 Safari/537.22";
string html = wc.DownloadString("https://www.microsoft.com/en-/itacademy/members/default.aspx");
}
Obviously if the site performs some javascript tasks they will not be executed and you cannot rely on them because the WebClient doesn't support that.
If on the other hand you are attempting to authenticate against Live ID, I would strongly recommend you using OAuth for that purpose. Here's the documentation which explains how to integrate this type of authentication with Live ID after you registered your application as a relying party.

Resources