According to this website: I am trying to make a request, send data, and hope to get the result like json format, but not have to be.
In the sandbox page, I've checked the javascript, (I am using Chrome browser, you can go to "resources" -> Frame folder -> sandbox.ala.org.au), it uses AJAX to send and get data.
For example, there is a function (parseColumns), which is using ajax for sending data and getting result.
Is there any other way instead of ajax that could make a request to the server and get the result data? Because I am trying to create an application work similar with the sandbox.
One alternative is to make regular http requests. The problem with this approach is that you have to decipher the data format for input and output.
You can see all the request/response traffic in details, from and to your browser, using firebug (https://getfirebug.com/) and enabling the "net" tab
when you mouse over the "POST" line in the URL column, it shows you the complete URL. Click on the (+) to expand the request item to see details on the request.
Related
As we all know JMeter is not supporting JavaScript till now, but is there any alternative way to extract data from JavaScript's Response Data (Not generating exact response which we can get using Browser) using Regular Expression Extractor and inject it as parameter for another HTTP Request?
Note: In the response page getting message as "JavaScript is required. This web browser does not support JavaScript or JavaScript in this web browser is not enabled."
I think you are looking at HTML view. As documentation states:
The HTML view attempts to render the response as HTML. The rendered HTML is likely to compare poorly to the view one would get in any web browser; however, it does provide a quick approximation that is helpful for initial result evaluation.
Images, style-sheets, etc. aren't downloaded.
In your case that view is not very helpful, since page has <noscript> tag, which ensures that you only see one message about missing JavaScript. So don't look at it, use Text mode instead, which gives you the actual page source.
Another confusion you seems have is that JavaScript has some sort of "response data". It does not. JavaScript is a client-side technology, while JMeter is working directly with HTTP requests/responses. So when client issues a new HTTP request (which could be result of JavaScript code, user operation, or anything else), JMeter representation of such request is always the same: HTTP Sampler, which has some response data, which, as I said, bast viewed in Text mode.
So bottom line is: likely you have no problem with recording or playback of your script, you are just not checking it correctly.
If you send the same request as the browser you should get the same response. If you are receiving only the error message regarding not-enabled JavaScript - your test is not working properly and doesn't mimic all the requests which are being sent by a real browser with 100% accuracy (i.e. you are sending only main request with JMeter while browser does few more AJAX requests which fetch data from the server and actually render the content).
It also means that your test does not make a lot of sense as each JMeter virtual user needs to represent real user using real browser as close as possible with all its stuff (cookies, headers, cache, think times, etc.)
So I would recommend the next steps:
Make sure you have correlation in place.
Make sure you are following recommendations from the How to make JMeter behave more like a real browser article.
Once done - compare the request(s) which are being sent by browser and JMeter using a sniffer tool like Fiddler or Wireshark the requests should be exactly the same (apart from dynamic data which needs to be correlated). If there are inconsistencies or missing requests you need to amend JMeter configuration to so JMeter requests would exactly match the browser ones.
As we know, GET method sends data via URL. We can use both GET and POST method in ajax. My question is, why can't we see the data in URL when we use ajax with a GET method?
AJAX call is not visible through url.
Try to use firebug extension of firefox.
In firebug, you will find all request in console.
When you fire off your ajax request like this:
The Chrome network tab will show new line for this transaction:
If you click on it, it will show you all the details:
If you'd like more information on constructing your own querystrings, look at this other question: How to build query string with Javascript
Using a TWebBrowser in Delphi, I'm showing a website that uses JSON to update its content. To get the source code of the newly updated content and load it into a Memo, I believe I have to get the URLs of the GET requests. Unfortunately, these are always different and generated with an encrypted Javascript. Is there any way to list the URLs the GET requests go to in a similar way like FireBug does in its console view?
Thanks a bunch!!!
I have a page with a middle ajax frame. This frame does a lot of requests. Last 2 requests are always this:
Last-1) Request GET page with url www.mysite.com/page1.php and the page response have always a text with "true" or "false".
Last) POST request with url www.mysecondsite.com/page2.php and the page response is empty.
I need to write an extension that reads if last-1 request is True or False and do something when last request is finish.... I tried use chrome.webRequest library but it didn't work...
How can I do this?
Edit: I know this, but I don't want script to do the request... Request are done by page because site need do some operation. I only need an extension to read this request.... but don't do it!
Edit2: I don't want to modify code on page.... I want only to check the response of this page (tab) at some AJAX request. I cant do ajax request or modify script.. only read response, is this possible?
You could make request to other sites using XMLHttpRequest object.
Chrome extension tutorial
Depending on how complex it is you could try replacing the function on the page that does the request with a copy that does the same but also sends the info to your extension.
Its hard to give advise without seeing the page in question.
I have a PHP MVC Web App and Apache mod_rewrite rules already working fine, but when I create forms using method="get", the submitted URL looks like
contact/submit?a=b&c=d
I would like my form to submit to
contact/submit/a/b/c/d
Both posting and getting the form work fine on the server side, but when using post method, the back button always asks for reposting the form values and furthermore I want the strings in the URL for SEO. I think JQuery might let me intercept the form submit event and refresh to the url dynamically, but it it seems there must be an easier way to do it that I am missing.
You could use the POST->REDIRECT->GET pattern that Spring Web Flow utilizes. This would allow you to post as you wish and then redirect to contact/submit/a/b/c/d. It would also solve the problem with the back button asking you if you want to resubmit your form data. See this related article.
The GET method uses standard query string arguments to pass form data via an HTTP GET request.
The HTTP GET request is not intended to modify any data on the server. POST is designed for modifying data on the server.
GET may be cached. POST will not.
/a/b/c/d is not a standard format (as in RFC) for passing data. However, for requesting data or URLs to post to, that has become popular.
So, if you are updating server data, just use a POST -> REDIRECT -> /a/b/c/d.
If you are just reading data from the server, then you will need to use a bit of Javascript to read your form values and construct a query string, and then go to it with window.location = ...
Have fun!