How to view request response for non Ajax Calls - html

I am working on a Web based application where the user interface is made using Jquery and the backend was developed using Java / Java EE.
On the user interface once I click on the submit button, the request goes and
the response comes from the back end. (This is not an AJAX call)
Is it possible to see what data went as request and how the response came back from the back end? Are there any such tools to view the request / response if it's not an AJax Call?
By the way I am using Chrome and Apple browsers.

Use the Network tab of Web Inspector (Chrome/WebKit) or Web Console (Firefox) or the Net tab (Firefox with Firebug)

Another option than using a browsers native network inspector (which btw DOES work for non-Ajax requests), is to use an intercepting proxy.
Burp Proxy is particular nice. It allows you to see, hold and if needed modify both the request and the response between the browser and the server. You do need to setup your browser to use a proxy. It has a somewhat steeper learning curve than the browser's native network inspectors, but once you get the hang of it it's quite an invaluable tool.

Related

Is a browser's console an interface to the web API?

From my research, the browser gives us some features that the JavaScript engine itself doesn’t provide: a Web API. This includes the DOM API, setTimeout, HTTP requests, and so on.
So because browsers run functions that are not supported in the JavaScript engine, like setTimeout for example, is it correct to say that the browser's terminal is an interface to the web and Web API.
Does that make sense, is that a constructive way to think about it?
I think that the WebAPI and the Console are two separate Things that both plug into the js-engine of your browser. The Console is not able to directly access the DOM for example, it can only execute javascript lines, that access the DOM internal and return a specific result (again returned via javascript)

does selenium knows to analyse the browser activity log or network activity?

I want to verify an ajax call was triggered
and also I want to detect a call to external custom protocol was triggered.
I think I will be able to read that data in this way only.
No, Selenium is not meant for such use case. Selenium WebDriver is just meant for simulating user interactions with web app. If you want intercept network requests, add custom headers etc during your selenium tests, you can use a proxy. BrowserMob proxy is popular for such use cases with selenium tests. It has a REST API too.

Using fiddler to capture html when no proxy support in browser

I'm using the webview tag in chromium and I want to capture the html requests. Unfortunately webview does not support proxies. Is there any way I can just do a normal http request to fiddler at localhost:8888 and somehow put the real destination in the URL? Maybe something like http://localhost:8888?url=google.com?
I'm not clear on which Chromium you're using, but generally I'd expect that it should adopt the OS proxy settings, and if it doesn't, that's a bug that should get filed.
Yes, you can send Web Requests directly to Fiddler using the technique you describe, but the cookies and security permissions aren't likely to work correctly.

How to find out element names within pop-up windows?

I'm testing a website. When I enter the URL, before the homepage loads, I get a pop-up window asking me to log in with a username and password. I need to find the names of the elements in this pop-up window.
Unfortunately, it is one of those "block everything else" pop-up windows that doesn't let me change tabs or open Firefox' menu.
I normally use Firebug for identifying a page element's name, but in this instance it's doing nothing to help.
I tried RESTClient and JMeter Proxy Recorder (aka HTTP(S) Test Script Recorder / HTTP Proxy Server), but neither of them could give me the information I need. I'm running out of ideas.
Any help is appreciated.
Modal dialogs prompting for credentials usually stand for authentication challenge which can be:
Basic
NTLM
Kerberos
Modal dialogs are part of the browser UI and can't be inspected using Firebug, because Firebug can just inspect elements within a website.
Basic Authentication can be bypassed by injecting credentials into URL like:
http://username:password#host.domain
However the right way to deal with all aforementioned authentication challenges is using JMeter's HTTP Authorization Manager. Being properly configured it constructs and sends a correct HTTP Header containing authorization details along with the request.
For details on how to configure HTTP Authorization Manager for different authentication types see Windows Authentication with Apache JMeter guide.

Sending POST request via HTTP using Safari on Mac

I need to call a webservice with Safari on Mac. Since the methods are in POST I can't paste the url in the address bar of Safari (like with GET methods).
So, I'm looking for a plug-in or similar that allows me to send the request and then receive the response inside the browser. The response is JSON so with the JSON plug in I can see all the response with his formatting.
Solutions ? Thanks !
Safari is my browser of choice, so I can empathize with you for wanting a native plugin. Fortunately, while there aren't any extensions available, there are quite a few native OSX clients for HTTP/REST end-point testing. I have been using CocoaRestClient, which includes auto-formatting and syntax highlighting for JSON, as you requested. It's open source, lightweight, and is at least actively supported by its developers:
http://mmattozzi.github.io/cocoa-rest-client
Another great tool is Postman, an application inside Google Chrome.
I don't know why you care whether the client is in Safari or not. A restful POST should be able to be executed from any sort of client. You might want to look at RESTClient extension for Firefox http://restclient.net/
Also just Google 'REST client' you should see plenty of other tools available to generate POST's against your service. If you are really would about Safari-specific responses, most good REST tools, should allow you to set the User-Agent header so as to make the request look like it is coming from Safari.