How to select random value from readonly datepicker in jmeter? - datepicker

We have a readonly datepicker which shows date from specific date/month/year (dd/mm/yyyy) format. Now since its readonly, passing input is not possible. How can we select date from datepicker?
Above requirement has simple form to submit.

You can use a Post-Processor in order to extract the value from the HTML code of the response and store it into a JMeter Variable
The most suitable Post-Processor for HTML is CSS Selector Extractor, you can use CSS Selectors in order to access "interesting" parts of the response.
Here is the demo of fetching date from the input assuming CSS Selector Tester mode of the View Results Tree listener:

Related

Adding current user and current date in the template in Blueprint development

I finished simple, intermediate and advanced blueprint tutorials of the Atlassian https://developer.atlassian.com/server/confluence/tutorials-and-guides/.
Currently, I have a soy file and a js file for Blueprint wizard page; a Java file as context provider and an xml file for template.
I added the current date to the title easily. I also want to insert current date and the current user (page creator) to the page before sending user to edit. (For example; default meeting notes blueprint). However I couldn't find how to set these values in template.
In xml template, the current date should be as following format:
<time datetime="2021-02-17"/>
So, I cannot add something like "<at:var>" for datetime value. So, I cannot change it from the context provider class.
Also, I tried to set this value through Javascript and JQuery, however I just can change things about the wizard page. I failed on manipulating the actual template page.
Nearly same issue with the page creator. I should add the user as following format:
<ri:user ri:userkey="2c9680f7405147ee0140514c26120003"/>
However, I couldn't set the userkey through Java and also I couldn't get the page creator value.
Thus;
How can I add the current date to the template page?
How can I add the user mention to the template page?
How can I get the creator of the page?
Thanks already for all your interests.
Have a nice day!
The answer is coming from me, too.
In template's xml, we are adding two variables for the date and the user with enabled XHTML support:
<at:var at:name="currentDate" rawxhtml=true />
<at:var at:name="currentUser" rawxhtml=true />
In the context provider class, we will set these variables with html tags:
context.put("currentDate", "<time datetime=\" + sdf.format(new Date()) + "\"/>");
context.put("currentDate", "<ri:user ri:userkey=\" + AuthenticatedUserThreadLocal.get().getKey() + "\"/>");
where the context is the context map for blueprint and sdf is the instance of SimpleDateFormat class with a pre-defined date (not date-time) format.

Setting Date as a prop in Adobe DTM

I'm trying to use Adobe DTM to pass the date to a prop variable but haven't had much success. The final output should be a prop report in Adobe that'll provide me traffic data for specific dates (5/11/16, 6/15/15 etc). The ultimate goal for setting the dates as a prop is to be able to classify a range of dates based on various business needs.
Could anyone point me in the right direction for getting this done? I am assuming I'll have to add a line of code in the s.code file that'll define s.prop5 = ...
Thanks
Based on your comments, it sounds like you are just looking to pop something with the current date stamp with "MM-DD-YYYY" format.
As Gigazelle mentioned, you can create a Data Element to return the value, and then reference it for setting your prop. However, throwing a data layer into the mix may be overkill for you, depending on your needs/limitations.
Data layers are meant for exposing data that DTM can't feasibly/reliably automate on its own via built-in features or hosting an autonomous js snippet.
The only reason you might want to consider having your site push it to a data layer, is if you want to generate the date via server-side coding to ensure the date is generated within the same timezone setting for all visitors. If you generate it client-side, it will be generated according to the visitor's browser/system settings. Since visitors are from all over the world in different timezones, the data may not be as consistent (even if you add additional code to change the timezone offset, it still may not be 100% based on browser version/security settings, or visitors who alter their browser/system date/timezone settings).
So, if you want to ensure the best accuracy, then I suggest you output the value via server-side code, and put into a data layer. How you do that depends on your server and what language you have at your disposal for your web pages being served up. Here is a very basic example using PHP:
<script>
var dataLayer = {
currentDate : '<?php echo date('m-d-Y'); ?>'
}
</script>
This will have the server generate the date stamp and output a js object called dataLayer with a property currentDate you can reference. You can create a Data Element as Type "JS Object" and for Path, put dataLayer.currentDate, and then reference your Data Element elsewhere (see below).
If that's too much trouble for you or if you want to keep it pure client-side/DTM and are okay with the potentially lower consistency...
Within DTM, go to Rules > Data Elements, and click Create New Data Element.
Name it "currentDate" (no quotes).
For Type, choose "Custom Script", and click Open Editor, and add the following:
var t=new Date(),d,m,y;
d=t.getDate();
d=d<10?'0'+d:d;
m=t.getMonth()+1;
m=m<10?'0'+m:m;
y=t.getFullYear();
return m+'-'+d+'-'+y;
Click Save and Close and Save Data Element.
Now you can reference the data element to pop prop5. How you do it depends on how you've setup Adobe Analytics within DTM. For example, if you set it up as a tool and only want it to pop on initial page view, you can open your AA tool config, go to the Global Variables dropdown, and set prop5 there. You reference it as %currentDate%
You can do the same %currentDate% syntax in a Page Load Rule or other rule or any other place that uses DTM's built-in fields.
Alternatively, if you need to reference it within javascript code (e.g. if you are setting prop5 within s.doPlugins or some other Custom Script box, you can reference the data element like this:
s.prop5 = _satellite.getVar('currentDate');
Set a JS variable on your site (such as within a data layer) that outputs the date in the format you wish to collect it in. Something like var d = Date();
In DTM, go to Rules > Data Elements and create a data element that maps to the JS variable you created on your site
If you want prop5 to be defined on every page, click the gear icon and map prop5 to your data element name by using %DataElementName% (whatever you named your data element in step 2, wrapped in percent signs). If you don't want it defined on every page, go to Rules and create a page load rule, event based rule or direct call rule depending on when you want the variable to trigger. Under the Adobe Analytics section of the rule, map prop5 to %DataElementName% .
This will allow you to collect dates as values, which can then be used in classifications.

How to get all the input values in a form using Selenium

Let's take a form of student details;
I want take take all these input data into a List or Set.
Please check the attached picture and give me any suggestions.
To get the inputs and the select you can use a selector like:
input, select option[selected=selected]
to get only the input use css selector for input tag:
input
to get also the selected inputs you could use:
input[type=radio], input[type*=text], select option[selected=selected]
you will need to add an extra attribute for the radio input to get only the selected ones, you might need to do dome updates for the select also.
These selectors are only an estimate of what you need since the html is not available.

Umbraco 7 - Extending RTE settings

My goal is to extend umbraco's Rich Text Editor data type to include a "char limit" field. Then, when using the data type in document type editor, there would be a field for a char limit to be set (rather than using a regex validation for that).
I have googled but the only thing I found until now was how to extend the RTE to add more buttons.
Is this achievable?
Thanks ;)
You can overwrite RTE's 'onKeyDown' event and handle the limit in the function's body. The url you provided in example shows how to create a field.
tinyMCE.activeEditor.on("keydown", function(e){
console.log(e.keyCode); //Your logic goes here
});
The next steps depend on how you are going to create your char limit. The easier solution is to set up a validation onSave event, also you can parse keydown's event object and return false, if the limit is exceeded

Is it possible to pass post data to the form (prefill form with data)?

For example https://stackoverflow.com/questions/ask there we have form id="post-form" which has method="post", is it possible somehow open this form and have lets say Name input (display-name) with my name prefilled on load?
Yes. You can do this many ways, with Javascript by setting the input's text, or you can do it server-side with PHP by echoing "value=\"$name\"" for the value attribute of the input.