JMeter random security questions - security

I am trying to configure JMeter test plan and in one of the thread groups, I need to read the displayed security questions and answer them correctly. The user needs to answer 3 questions that will be displayed randomly from the list of 5 that the user selected when setting up his account.
How would I go about this? I can control the same 5 questions for all the users(when registering), but I cannot control the 3 that will be displayed randomly during my test.
Any pointers? Thanks.
EDIT:
The Question1 Value is parsed and the actual question and not the variable as in the original code, this is the response
<div class="aaaaa">
<label class="aaaaa">Question1 Value?</label>
</div>
<div class="aaaaa">
<label class="aaaaa">Question2 Value?</label>
</div>
<div class="aaaaa">
<div class="bbbb">
<input id="answer1" name="answer1" class="aaaaa" type="text" value=""/>
</div>
</div>
<div class="aaaaa">
<div class="bbbb">
<input id="answer2" name="answer2" class="aaaaa" type="text" value=""/>
</div>
</div>
So if I am using IF Controller in the response, how would I form the condition. I need to be able to create 3 if conditions(need to check for possible 3 conditions - q1&q2, q1&q3, q2&q3). Since the questions are displayed as labels, I am not sure how would I put the condition.
Thanks.

General answer would be:
Use Regular Expression Extractor Post Processor to figure out what question(s) is(are) being asked
Use If Controller to execute specific HTTP Request sampler(s) depending on what questions are.

Related

Does waitForElementVisible not search for input elements?

I am using nightwatch.js to perform end-to-end testing and have to use a roundabout method for a waitForElementVisible command to work as expected. For example, my code below:
browser.waitForElementVisible(".profile label[for='Admin']") // works
browser.waitForElementVisible(".profile label[for='Admin'] input[id='Admin']") // breaks
For further clarification, I am testing to see if a radio button is visible. The radio button's DOM elements is as such:
<div class='profile'>
<div class='roleSelector'>
<label for="Admin">
<input type="radio" id="Admin" class="Admin">
</label>
</div>
</div>
As far as I know, there is no such specific case.
Did you try using '.profile input[id='Admin']' ?
Hope that serves your purpose at hand.

Node.js Getting values from html and using req.body.<name>

I am trying to retrieve multiple values from HTML and make use of it using req.body..
I am able to do this via message: req.body.message
<form id="message-form" class="input-group input-group-lg" style="">
<input type="text" name="message" class="form-control" aria-label="Large" aria-describedby="inputGroup-sizing-sm">
<div class="input-group-prepend">
<button class="btn btn-primary">Send</button>
</div>
</form>
However, I would like to retrieve the values from elements that are not inside the e.g <span id="item" style="font-weight:bold"> </span>
The reason is that when I load the page, it renders these values dynamically (retrieved from database). When I want to do a POST, I would like to make use of these values that have been rendered previously.
Is there a way to do this?
Many thanks.
Forms don't submit data that does not appear inside a form control.
So you can either:
Store the data somewhere in the server (such as in a session) where you can read it back on a subsequent request (watch out for race conditions!) or
Put the data in a form control instead of or as well as in the span. (Possibly using a hidden input).

How do I localise the strings used by the Azure API Management Developer Portal ?

I can't seem to find a way to edit the localised strings using the provided template editor , does anyone have any pointers on this ?
For example if I wanted to change the text 'search products' to something else for example... Where/How can I edit the template and its data ?
Thank you
Le Roi
The ugly way to do this:
Edit the template, remove the
<search-control></search-control>
And add a custom text to the input placeholder
<div>
<form action="/Products" class="pull-right" method="get">
<input type="hidden" name="startEditTemplate" value="ProductList">
<div class="form-group has-feedback">
<input placeholder="My Custom Search products" id="pattern" type="search" class="form-control" name="pattern" spellcheck="false">
<button class="glyphicon glyphicon-search form-control-feedback ap-ininput-button"></button>
</div>
</form>
</div>
The bad part about this is that you are now responsible for updating this piece of code and template.

Forcing Chrome to never save password on a specific site

I'm at beginner level for Chrome Extension development, but not new to software development. I manage ChromeOS devices across an entire school district. There is a specific testing site that requires students to login with a username and password. The password is always the same depending on a specific test. Teachers are finding that students are using saved passwords to skip to the next quiz.
We can disable password saving for all sites, enable it, or allow user to configure. I really do not want to disable password saving, as it is useful (especially for younger children) to not have to retype the password.
My only solution at this point is to push out an extension that manually adds the site .neversavepassword.com to the "Never Save" section of the Manage Password. However, after searching for the last 2 days I cannot seem to find any information on how I would do this (it does not seem possible).
What are my options at this point? The site already uses "autocomplete=off" but Chrome is ignoring this.
Here is the login form.
<div class="row-wrapper">
<div class="login-row">
<label for="tbUsername">User Name </label>
<input name="ctl00$cp_Content$tbUserName" type="text" value="test" maxlength="50" id="tbUserName" tabindex="1" class="loginTB" autocomplete="off" />
</div>
<div class="login-row">
<label for="tbPassword">Password </label>
<span><input name="ctl00$cp_Content$tbPassword" type="password" maxlength="20" size="25" id="tbPassword" tabindex="2" class="loginTBn" /></span>
</div>
<div class="login-row">
<button onclick="__doPostBack('ctl00$cp_Content$btnLogIn','')" id="btnLogIn" type="button" class="button hollow white" tabindex="3">
<span id="ctl00_cp_Content_spLogin" class="text">Log In </span>
<span class="glyph glyph-chevron-next"></span>
</button>
</div>
I'm thinking I can modify the form via javascript, but so far I've not had luck.
I appreciate any suggestions with this issue. Thank you!
First off, Chrome's official position is more or less "ignore any attempts to circumvent that".
Extensions cannot interact with the password manager, so that's not a way to a solution.
Update: There is chrome.privacy.services.passwordSavingEnabled, but that doesn't allow fine-tuning by site, it's only an on/off switch.
I've seen a page circumvent the mechanism by grabbing the credentials from the form with page code, clearing the form, and then doing a POST that's not connected with the original form. That confuses Chrome enough to think that the values were not used. Again, there's a good reason not to do this.

Add a form with POST method on a SharePoint 2010 page?

The HTML I got asked to add to a page is:
<div>
<div> Click below to enter</div>
<form id="formID" method=POST action="http://www.someWebsite.com">
<input type="submit" name="do_login" value="Log in" />
<input type="hidden" name="username" value="someUsername" />
<input type="hidden" name="password" value="somePassword" />
</form>
</div>
I know I can't add a form like that because there is already on that SharePoint created, I had a look at http://www.sharepointboris.net/2008/09/making-post-and-get-forms-from-sharepoints-pages/ but when I follow the example and save SharePoint still strips out most of the code so how can I achieve what I want in another way?
Thanks in advance.
For our SharePoint 2007 installation, I created a quiz web part. Basically, it pulls questions and answers from a list, but the actual questions are presented and submitted using a form with POST variables. It's probably much more complex and in-depth than you're looking to go, but I made a custom web part to present the form, read the post variables, and execute associated functions. The big plus to using a custom web part is that you're able to put in nearly any content you want, since you're coding it in ASP.NET.
What I did was to create a custom .aspx page (not through the sharepoint gui) with the code I posted in my question, uploaded the page to a library and then linked to it via a page viewer web part
You can get the form to work as normal if you remove the tags and place the form control inside a div like so:
<div>
<div> Click below to enter</div>
<div id="formID" method=POST action="http://www.someWebsite.com">
<input type="submit" name="do_login" value="Log in" />
<input type="hidden" name="username" value="someUsername" />
<input type="hidden" name="password" value="somePassword" />
</div>
</div>
This way sharepoint will accept everything inside the div tags. In a asp.net when you create a page in sharepoint, the whole page is containied withing a form that why sharepoint does not allow you to use another form within it.
Hope this helps

Resources