Unable to log into site with JMeter - html

I am currently learning how to use JMeter so I can test my company's website. I set up a thread group and put in a few HTTP requests that should log into the site and navigate the tabs. The problem is that it does not appear to be logging in. When I look at the response data, I see that the log in request returns the correct temporary redirect page, but every request after that simply returns the html for the initial log in page.
I have tried using a simple HTTP request that sets the username and password text boxes to account details I know work. I have also tried using a Login Config Element and an HTTP Authorization Manager, and they all get the same thing. I tried changing the redirect options as is suggested here, but it was already set to "Follow Redirects". I tried switching it back too, and that didn't work.
I don't know what to do here. Can anyone help me out?
EDIT: I am going to be away on break for the next week, so I won't be able to respond to answers. I'll be back on Dec 3rd.

In the absolute majority of cases it's connected with cookies.
Try adding HTTP Cookie Manager and see what happens.
If you want to manipulate cookies you may wish to store them to JMeter Variables. To enabled this functionality you'll need to set next property:
CookieManager.save.cookies=true
The property lives in jmeter.properties file under /bin folder of your JMeter installation.

it depends how page is reacting if the session is getting stored in cookie you need to have cookie manager. otherwise search for session_id, or token you need to extract token using regular expression extractor and pass it with login form user name and password.
i hope below video can help you little
http://www.youtube.com/watch?v=1V0E8CEabUY

Related

Is there a way to safely pass queries to a non-dynamic page in NextJS?

In my nextJS project I want a feature like below:
If a logged out user want to access a url that is not for a logged out user, redirect to
login page.
After user make a successful login, redirect him/her back to the
page from where he/she was redirected.
I read about some article that were describing how to use sessionStorage or localStorage to achieve this.
I am just wondering can I achieve the same using more suitable and easy way.
I tried followings:
first I tried to achieve that using document.refferer but that doesn't seem to work with nextJS.
then,
I observed some websites [including flipkart], and sent a query parameter containing the current path when redirecting to the login page. And it works fine.
But I am getting a warning from nextJS because my login page is not dynamic hence it can not have path other than /login and /login#
Is there a way to overcome this warning ? without make it like login/[queries].jsx
Any help would be appreciated. Thanks in advance..

Is there any way to make Postman default to opening saved requests in new tabs

I know from the Postman docs that I can open saved requests in a new tab either by creating a new tab before clicking on the saved request or with a keyboard shortcut, but I'm hoping there's a way to default Postman to always open requests in new tabs - like the standard functionality of most IDEs.
I frequently find that I've sent a request, then a second, different one and wish I could check something in the response for the first request, but it's no longer there, because the second request opened over the first.
Obviously if I know that I'm going to want the first response, I can explicitly save it, but that's quite cumbersome, and it's usually only after I've sent the next request that I realise I want to refer back.
I suspect the answer is probably to build muscle memory to always hold Ctrl + Shift when clicking a saved request, but it would be nice if there was a setting.
Just realised that this is now possible (or perhaps always was and I just missed it) - in the 'General' tab of the Settings dialog, under the heading 'REQUEST' is a switch for 'Always open requests in new tab'.
There is a setting for this. This image will help:

RainLoop - Pass values in a URL link and automatically Sign In

I am trying to pass a value using a link.
For example, if I want to add an email and password for a user to Sign In straight away in the RainLoop webmail.
I am trying using
http://demo.rainloop.net/?RainLoopEmail="new#email.com"&RainLoopPassword="12345"
or
http://demo.rainloop.net/?RainLoopEmail="new#email.com"&RainLoopPassword="12345"#ID
Is this possible to do?
It is possible but you will have to rewrite the rainloop PHP files by yourself. Also parsing passwords via the GET method is a very bad idea. Get commands will stay in your history so everyone who types in
demo.rainloop.net will see the ?RainLoopPassword="12345" also. It's not recommended, but possible. Another safer solution will be using the POST method. I suspect you will use this for you bookmarks or something? You can make an AJAX page which sends a POST request with the username and password to demo.rainloop.net. This way nobody will see your passwords and the effect is the same.
EDIT: For using an AJAX page you have to own a webserver, or register on a free hosting like http://freehostingnoads.net

Watir Webdriver +Chromedriver: ADFS Authentication

I'm attempting to load a page that does a call to ADFS for authentication purposes. On the page load, there is a redirect and then popup to enter credentials.
HTTPS must be used.
Chrome must be used as the testing browser.
So, when loading the page everything is working fine, but I'm forced to manually enter credentials when running the test. After inputting the credentials everything is fine, but is there a way to leverage Watir to input this for me? I've tried popping the username:password into the link already with no success, and since I really need to use Chrome the Firefox plugins are moot.
require 'watir-webdriver'
b = Watir::Browser.new :chrome
b.goto 'https://internalUAT.clientwebsite.com/'
b.link(:text => 'HR Dashboard').click
I'm not allowed to post images due to reputation constraints, but please visit
https://i.imgur.com/ExVt8fp.png
for a screenshot.
When you try passing credentials with the https://user:pass#foo.com technique, do you have any unusual characters in the username or password? (Maybe you have a DOMAIN\username domain prefix?)
If so you might want to make sure any such characters in the credential string are properly escaped.
If that's not the problem, and there's no other way to disable the auth prompt for your tests, then your best bet (IMO) is to write a separate script (or thread) that uses RAutomation (or some other UI automation library of your choosing) to enter your credentials and click the Log In button.
See https://github.com/jarmo/RAutomation
The test cases in the following file contain examples of using RAutomation's send_keys method, which could prove useful:
https://github.com/jarmo/RAutomation/blob/master/spec/window_spec.rb
For the record, it looks like RAutomation may have been used by watir-classic for dialog handling:
https://github.com/watir/watir-classic/blob/master/lib/watir-classic/modal_dialog.rb
http://www.rubydoc.info/github/watir/watir-classic/Watir/ModalDialog

Handling HTML PDFs with Auth Required Images

I'm currently creating pdf documents server side with wkhtmlpdf and nodejs. The client side sends the html to be rendered (which may include img tags with a source). When the user is previewing the html in the browser the images they uploaded to their account show fine because the user is authenticated via the browser and the node route can simply look up the image based on the user id (saved to session) and image id (passed in each image request).
The issue is when the images are attempting to be rendered in wkhtmltopdf webkit the renderer is not authenticated when it makes the request for images via node's exec of wkhtmltopdf in a separate process. A request to something like GET /user/images/<imageId> will fail due to the session not being set when the request is made inside the headless wkhtmltopdf renderer.
Is there a way to pass authentication via some wkhtmltopdf option or possibly a different way of authentication for images? The only restriction is not making images public.
I asked a similar question a while back that might help you:
Generate PDF Behind Authentication Wall
WKHTMLTOPDF has --cookie-jar which should get you what you need. Note that it didn't for me, and I wound up answering my own question with an alternate solution. In a nutshell, I wound up accessing the page via CURL - much more flexible - then writing a temporary that I converted to PDF, then deleted the temporary file.
A little round-a-bout, but it got the job done.
To implement authentication I allowed a cookie id flag ( with connect the key defaults to connect.sid ) as a query option in my image routes. The only "gotcha" is since images are requested from the server's perspective, you must ensure all your image paths are absolute domain paths rather than relative to your application ( unless those two are the same of course).
Steps for Expressjs:
Setup the id flag middleware which checks for say sid in the query via req.query (eg ?id=abc123 where abc123 is the req.cookies['connect.sid'], or req.signedCookies['connect.sid'] if your using a secret as you probably should )You may need to ensure the query middleware is setup first.
Ensure the req.headers contains this session id key and value prior to the cookie parser so the session is properly setup (eg if a cookie exists append a new one or if one does add it as the first req.headers.cookie = 'connect.sid=abc123;')
Ensure all image paths contain the full url (eg https://www.yourdomain.com/images/imageId?id=abc123)
Some extra tid bits: The image source replacement should probably happen at the server level to ensure the user does not copy/paste the image url with the session id and say email it to a friend which obviously leaves the door open for account hijacking.