"HtmlUnit" Driver with Jmeter shows errors in javascript - jmeter

I'm trying to add a "WebDriver Sampler" in Jmeter with "HtmlUnit Driver Config". Have written a simple come, which opens a webpage. But in the back ground, there are tons of errors / warnings related to JS and CSS, present in the web page.
Something like this
2018-06-19 11:57:45,993 WARN c.g.h.IncorrectnessListenerImpl: Obsolete content type encountered: 'text/javascript'.
Some of the previous questions says its due to old JARs, but I have all latest.
1. Is there any way to solve this ?
2. Can we set logLevel in the webdriver sampler ?

No one will be able to provide answer to point 1 unless you provide the URL of the page you're trying to test.
Looking into the warning itself - it indicates a bug in your system under test as valid Content-Type for JavaScript should be application/javascript so you can raise a defect to get this fixed.
If you totally sure that the behavior is expected and there are no plans to fix these "tons of errors" you can add the next line to log4j2.xml file in "bin" folder of your JMeter installation under <Loggers> tag:
<Logger name="com.gargoylesoftware.htmlunit" level="fatal"/>
See How to Configure JMeter Logging article for more information on tuning JMeter logging subsystem.

Related

JMeter embedded resources being downloaded when disabled

I have recorded a simple get/post test using the Blazemeter chrome plugin and am tweaking it in JMeter to be ready to use. However, the test fails because one of the embedded resources fails to load, which if it was correct, would be understandable.
I don't know if I am not understanding what I am seeing in the View Results Tree listener but I have some questions:
I don't need to download embedded resources but even though the box is NOT ticked on the http requests, they are still shown as downloaded. However, for the GET, these are dowloaded successfully.
I think that the post is failing and the same page is being returned by the server but when it comes to reloading the embedded resources, they all succeed except for one to fonts.googleapis.com, even though the same request always works for the get request
The failure is always the same each time I run it. Always, the embedded resources download correctly with GET and always that single 12th request to google fails with a 400.
Please can someone advise how to 1) Actually stop embedded resources from being downloaded and 2) work out how to debug why a second request to the same resource always fails even though it is simply an embedded font?
JMeter Chrome Extension adds HTTP Request Defaults configuration element which populates the values for all the HTTP Request samplers in its scope. So if you don't want to download embedded resources (although it's not recommended) you need to open "Advanced" tab of the Defaults configuration element and untick the box there
There is a special property which controls whether a problem with fetching an embedded resource is treated as failure or not, if you would like to download embedded resources but at the same time to ignore failures you can add the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
upon JMeter restart problems with embedded resources won't fail the parent HTTP Request sampler. See Configuring JMeter user manual chapter for more details if needed.

JMeter HTTP Request shows a second failed result of a wrong URL

My results tree shows a separate status for a URL connection I have absolutely no idea where it might come from:
The first result with the -0 at the end is that of the request I send willingly. The other connection with the -1 comes out of the void.
In the response body I can see that JMeter fails while trying to resolve the DNS name:
java.net.UnknownHostException: aida.xyz.removed
at java.base/java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
at java.base/java.net.InetAddress$PlatformNameService.lookupAllHostAddr(Unknown Source)
This is my definition of the HTTP Request:
As you can see this goes to a totally different host and protocol (http instead of https).
I checked the defined csv, it does not contain the hostname "aid". Same goes for the JMX file and any environment variables set.
I am using Apache JMeter 5.0
After I read Ubiks answer I checked if there are any redirects in the first request. There are no redirects but in the content there are several script and img resources.
It looks like JMeter parses the first request for resources it has to download. But I didn't enable this setting / don't even know where to activate this.
I guess it’s either a redirect issued from response to the first request or because JMeter tries to download embedded resources.
Check the response of first request.
If the reason is that JMeter downloads (probably missing) resources, make sure you disable Retrieve All Embedded Resources in the Advanced tab.
The error you're getting indicates the problem with the system under test, JMeter cannot resolve an embedded resource - image, script, style, font, iframe, whatever.
You need to raise an issue as not available content is not good i.e. for SEO purposes, moreover it might be essential for your application functionality of LAF
If this is a known issue which is in process of fixing (or considered as won't fix) you can turn JMeter's check for embedded resources presence by adding the next line to user.properties file:
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.
More information:
JMeter Properties Reference
Configuring JMeter
Apache JMeter Properties Customization Guide

jmeter removes slash (/) from requested URL's

I requested a web page using Jmeter with "Retrieve all embedded resources" enabled. When I ran the scenario, some URLs' of pictures did not open with the error "Bad Request". When I compared the working URL and URL that Jmeter checks, I realized that / is missing on the URL that Jmeter checks.
Screenshot
Screenshot2
What should I do to fix this?
It looks like a bug in JMeter.
You should submit a bug following this doc:
http://jmeter.apache.org/issues.html
Ensure you attach:
- the HTML page content that contains the links
- The jmeter.log
- A sample test plan
I tried the same with the version 2.13. No problem, which means that version 3.3 is buggy in terms of this issue.

Getting erorr 404 while replaying

I recorded a script through chrome extension. but when I replay the script
got error ,I checked in view result tree and expand the sampler there are plenty of files in which a .js file is throwing 404 error.
How can I remove this file(Sample)
Help Please!
enter image description here
You can turn off failures reporting for embedded resources by adding the next line to user.properties file (lives under /bin folder of your JMeter installation)
httpsampler.ignore_failed_embedded_resources=true
JMeter restart will be required to pick the property up.
You can also pass this property via -J command-line argument like:
jmeter -Jhttpsampler.ignore_failed_embedded_resources=true .....
See Apache JMeter Properties Customization Guide for more information on different JMeter properties types and ways of setting and overriding them

Jmeter null url detected (should not happen)

My jmeter log indicates me alot of same kind of warnings which makes me clueless
WARN - jmeter.protocol.http.sampler.HTTPSamplerBase: Null URL detected (should not happen)
what should i look for? i ve googled around but cant find any info related to my issue.
Add: The Test at all is running fine.
This happens when you check download resources.
The message is issued when one of the URLs returned by the HTML Page parser is null.
This is not supposed to happen, if it does it seems to be a bug:
https://issues.apache.org/bugzilla/show_bug.cgi?id=55092
As per your bug report, it happens because you have iframe tags which source is:
about:blank
Bug will be fixed in 2.10 version of JMeter
As a workaround you can uncheck download resources, you test will then work only on dynamic resources, not static ones (images,css,js ...)

Resources