Jmeter: " < " in dynamic variable - variables

New to Jmeter. Still learning. Any help will be appreciated.
Login post request:
GET https://exe.example.com/dsfs/ls/?wa=esignin1.0&trealm=https%3A%2F%2Fexe.example.com%2F&wctx=rm%3D1%26id%3D82339bbd-7cdb-4372-ae5f-65efd2dac185%26ru%3Dhttps%253a%252f%252fexample.com%252fdefault.aspx&wct=2014-05-08T17%3A47%3A46Z&wauth=urn%3Aoasis%3Anames%3Atc%3ASAML%3A1.0%3Aam%3Apassword
Above is the post request where I send values for wa, trealm,wctx, wct, wauth which I get from previous response.
For the above post request I get the below response with one more hidden variable "wresult"
<html><head>
<title>Working...</title>
</head>
<body>
<html><head><title>Working...</title></head><body>
<form method="POST" name="hiddenform" action="https://exe.example.com/">
<input type="hidden" name="wa" value="esignin1.0" />
<input type="hidden" name="wresult" value="<t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"><t:Lifetim….…….../trust/Issue</t:RequestType><t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>" />
<input type="hidden" name="rctx" value="rm=1&id=f71cbbfb-c9f6-4255-bb38-f9ec81f1d4aa&ru=https%3a%2f%2fexample.com%2fdefault.aspx" />
<noscript><p>Script is disabled. Click Submit to continue.<input type="submit" value="Submit" /></noscript></form><script language="javascript">window.setTimeout('document.forms[0].submit()', 0);</script></body></html>
I have to send wrestle value in my next request. wrestle value should be like below.
<t:RequestSecurityTokenResponsexmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust<t:Lifetim……………entity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>
but instead wresult value is being sent as
<t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust"><t:Lifetim….….……entity/NoProofKey</t:KeyType></t:RequestSecurityTokenResponse>" />
In browser I'm guessing something replaces "<" with "<" . I have checked everything, it looks like the request is failing because "<" is not getting replaced by
"<" in jmeter. Is my guess right? If yes, is there a way to edit wresult's value in Jmeter and then send it in the request?
Could anyone please let me know how to solve this issue?

JMeter does not execute any javascript But your Browser does!
So You might be correct!
So, in your analysis, If "<" - only this is causing issues - You can use BeanShell PostProcessor / PreProcessor to look for the char/string to be replaced and replace it with what you want!
http://jmeter.apache.org/usermanual/component_reference.html#BeanShell_PostProcessor

Try to use "Content encoding:" "UTF-8" or "iso-8859-1" in your HTTP Request.
Also you have to Check the parameters in "Encode?" column of your request.
hope this will help.

If it's the only place where you're experiencing this problem you can work it around by adding a Beanshell Pre-Processor with the following code:
String wresult = vars.get("wresult").replaceAll("<([^.]*?)", "<");
vars.put("wresult",wresult);
Add Beanshell Pre Processor with the code above as a child of the request, in where you're trying to pass wresult variable.

Related

Not able to use attribute selector in cypress

My HTML fragment is:
<label class="email">
Email
<input data-test="email" type="text" v-model="curMember.email_address">
</label>
Then in my cypress test the following 'GET' does not work (using attribute selector):
cy.get('[data-test="email"]').should('have.value', 'a#test.com')
the above times out trying to find the element but the folowing does work (using a class selector)
cy.get('.email>input').should('have.value', 'a#test.com')
Can anyone tell me what my problem is?
I am not sure that cypress provides of getting value from NON-class
but take a look at this https://docs.cypress.io/api/commands/get.html#Selector
for the first example, you can only check the length
cy.get('[data-test="email"]').should('have.length', '10')

How to extract viewstate and eventvalidation using regular expression parsing partial renders with JMeter ASP.net

In my case, I am able to extract viewstate and eventvalidation from response, when the response is like:
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="UGflz/O67VPwTmNdi......"
by giving expression as:
name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"
but what is the expression i need to use, when the response is like:
|hiddenfield|__viewstate|koflrijcjafaygr......|
How can I extract this type of response.
use "\" to escape | as
for example to extract viewstate value from
|hiddenfield|__viewstate|koflrijcjafaygr......|
You can use this regular expression __viewstate\|(.+?)\|
You can follow this blogs for such information
I have applied below and make it work
expression: VIEWSTATE|(.+?)|
Template:$1$
Match No: 1

Anglesharp context.openAsync() returns unrecognized character. What can I do?

I am using AngleSharp to "open" a URL, change the value attribute of an input and then submit the form.
BUT when I get the HTML code from the URL, I get an unrecognized char in the name attribute of the input that interests me. See:
<!DOCTYPE html>
<html>
<head></head>
<body>
<hr>
<center>USER MENU<hr></center>
<form method="post" name="input" enctype="text/plain">
<fieldset>
<legend>ENTER USER CODE</legend>
ENTER USER CODE: <input type="password" name="�00" maxlength="4">
<br>
<button type="submit" formenctype="text/plain">SEND</button>
</fieldset>
</form>
</body>
</html>
As you can see this is the only input in the form so I can "catch" it (to change the value) by other attributes of it as selectors. Like this: [type=password]
context.Active.QuerySelector(Of IHtmlInputElement)("[type=password]").SetAttribute("value", "1111")
So, the problem is when I submit the form, it sends the post data with wrong name and they cannot get recognized. I learned what the unrecognizable character is by opening this URL in browser, and double check it using Wireshark (to get the HEX value of the char).
Finally, the char was a greek A in the browser source view and as Wireshark said it was the Symbol of C1 which is Á with description: Latin capital letter A with acute (see http://www.ascii-code.com/)
I know the man who created this web interface and he told me he used a greek A by fault and he cannot change it (I will explain why).
So, now that I know what the server expects I thought I could set the name attribute too and then send the form. But when I do it doesn't get recognized neither cause as I check in Wireshark the char is not the same char the browser sends when you submit the form. (I struggled to set the right name with no luck).
I also thought it may be some kind of encoding issue but I didn't manage to set the encoding in the context configuration. I set the culture to "el-GR" before I get the HTML but nothing changed.
What can I do? Do you have any suggestions?
PS. This is a low security web interface hosted by a microcontroller. The HTML cannot be changed because the device has already got a certification. Also, the interface works perfectly when used in browser.
I had to create a class that Implements the IEncodingProvider interface and then supply an instance of this class to the Configuration constructor via the with method.
Here is the class:
Private Class FixedEncodingProvider
Implements IEncodingProvider
Public Function Suggest(locale As String) As Encoding Implements IEncodingProvider.Suggest
Return Encoding.GetEncoding(1253)
End Function
End Class
and then use it like this:
Dim Config = Configuration.Default.WithDefaultLoader.With(New FixedEncodingProvider())
Dim context = BrowsingContext.[New](Config)
Special Thanks to the library's creator FlorianRappl for the guidance!

Sailsjs Waterlock - Set up multiple auth methods

I have been learning how to use SailsJS most effectively, which includes using authentication. After the nightmare that sails-auth gave me, I decided to use Waterlock.
I have a default setup with Waterlock. I am trying to use multiple auth strategies (waterlock-local-auth + waterlock-google-auth).
Whenever I POST credentials to the register page, I am presented with
HTTP 400: you must specify a type parameter.
After reading the code, I notice I must submit an authentication type string with my form submit. So I add <input type="hidden" name="type" value="waterlock-local-auth"/> to the form. However, now I am presented with this:
HTTP 400: unknown/invalid authentication type
Why?
The proper way to encode the type string in the form data this way:
Your auth package name is waterlock-x-auth
The value on the input tag should be x
The input tag (if using local, for example) would look like this:
<input type="hidden" name="type" value="local"/>

placeholder input field not showing value?

I have an input box with placeholder.and I am setting the value in this field via Session variable in php.
This is the code which I have written :
<input type="text" value=<?=$_SESSION['no_of_persons']?> name="no_of_persons" id="no_of_persons" placeholder="No. of Person(s)" maxlength="3" />
and when I run this in firefox and watching the code in Firebug this following code is coming :
<input id="no_of_persons" type="text" maxlength="3" placeholder="No. of Person(s)" name="no_of_persons" value="7">
Problem is I am not able to see the value in textfield in the web page.
I go to firebug and edit html in firebug. What I do is when I press an space key at the end of input tag i.e after value="7" then the value 7 becomes visible on web page.
I am not getting why the browser automatically changing the sequence of attributes of input tag and also I already had closed input tag then why the browser not closing it.
I tried it in other browser also like safari,chrome but not working.
Please help me to get rid off this problem.
Thanks in advance!!! :)