How to fetch Omniture 1*1 image request parameters using TestNG and selenium Grid - selenium-rc

I am new to selenium and TestNG . Can any one give me some example to fetch 1*1 Omniture image request parameter?

Do you just want to see what information was passed in the parameter? You could use something like Charles to see all the details. Its a simple pixel request, so you can grab that URL and parse it out if you need a little more info. The image request will always contain /b/ss/ so it should be easy to grab.

I had a similar question, the following appears to be a solution:
http://samaitra.blogspot.com.au/2012/05/http-profiler-using-selenium-to-track.html

Related

How to add a variable from Json extractor into an array in JMeter?

I'm new here and also a beginner on JMeter and maybe this was already answered in an old post that I didn't find, sorry if this is the case.
I had this Post request I need to send with all these IDs that vary according to the account
Post Request
In order to get all of the IDs, I used the JSon extractor to put then into a variable
JSon extractor, then I got all the FieldIDs that I need.
ID extracted
But now how can I add this variable inside the request? I tried something like {"ids":"${fieldId}","includeBoundary":true} but it didn't work. How can I use this?
Please see: HTTP Request parameter dialog example
If you need to extract the whole response, save it into a JMeter Variable and send it back to another endpoint - the easiest way is using Boundary Extractor providing empty left and right boundaries
If you need more complex transformations - take a look at JSR223 Test Elements and Groovy language
I solved my problem in a so easy way(damn it)!!!!
On the Json extractor I just marked the option "Computer concatenation var (suffix_ALL)" then on the debbuger I got all IDs I needed in only one line and finally on my request I just add on the body data the line {"ids": [${fieldId_ALL}],"includeBoundary":true} and bingo it worked like a charm!!!!

How to parameterized request if getting recorded script like this.? See details

How to parameterize request if I am getting something similar to the following for login POST request in body data tab.
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"testuser\"},\"password\":{\"digest\":\"5811c74a581ffdb892ab9eddfb9cf2d21772a98332a59de6aa26989e01f84057\",\"algorithm\":\"sha-256\"}}],\"id\":\"7\"}"]
It's generally easy to correlate when we are getting in Parameters TAB, but in cases how we can proceed? For all further requests - it's the similar case.
I tried to switch to Parameters TAB, but it says that it can not be converted to that format.
So How we can proceed?
The same way, just substitute hard-coded (recorded) values with the relevant JMeter Variables directly in the request body like:
"{\"msg\":\"method\",\"method\":\"login\",\"params\":[{\"user\":{\"username\":\"${username}\"},\"password\":{\"digest\":\"${password}\",\"algorithm\":\"sha-256\"}}],\"id\":\"${id}\"}"]
The most commonly used for parameterization test element is CSV Data Set Config, however other options exist.

Extract value from javascript object in site using xpath and import.io

I want extract a number provided by javascript object in site, but I really don't understand that I am doing.
I tried different versions using alike examples and guidelines in import.io site and other tutorial sites, but I got only 1 of two results: extracted all numbers on given page or nothing at all.
I tried e.g. //[contains(.,"Unikālo apmeklējumu skaits:")]#type ; //[contains(.,"Unikālo apmeklējumu skaits:")] . Most likely it's necessary to add there something else, but I just don't know that.
Link I am interested in to extract from is: https://www.ss.lv/msg/lv/clothes-footwear/womens-clothes/trousers/ikcbb.html and information necessary is a number after text "Unikālo apmeklējumu skaits:" which is given by javascript.
Hopefully someone will be able to help me with this problem.
For someone who is new in web-scraping this should be a hard task, I'll ty to explain it. First of all, the xpath to get to that location could be something like this:
'//td[#class="msg_footer" and contains(text(), "Unik")]'
Now you have that tag (and what it contains), but if you check it doesn't contain the number you need, that content is being dynamically loaded with a javascript, and the javascript is this one:
<script type="text/javascript"><!--
var ss_w='rādīt numuru';
document.write( '<scr'+'ipt id="contacts_js" src="/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t='+new Date()+'"></scr'+'ipt>' );
--></script>
which could be gotten from the response with this xpath:
'//script[contains(text(), "contacts_js")]/text()'
from that string, you should replicate the url that comes in src, so this url for example:
/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t=
and add to the end the current date, as javascript creates it with new Date(). Then you should make a request to that url (adding the previous response domain), so something like:
https://www.ss.lv/js/2015-10-27/37863/VHoBGkpqSV8bfwkdTX9AXEpZXCVDlASIQ1ZV3kK.js?t=Wed%20Oct%2028%202015%2020:56:42%20GMT-0500%20(PET)
check that the date is urlencoded. it should return a response like:
var PHONE_CNT=-1;var PHONE_CNT2=-1;var PHONE_CNT3=-1;var EMAIL_CNT=-1;var SHOW_CNT=22;var PH_c="";var PH_1=0;var PH_2=0;var PH_3=0;
pcc_id=0;PH_1=gpzd("JTg3aCU3QyU1QnolN0MlN0JYcWh6JTVCdCU5NSU4QyU5MnV4ayU5QXElN0IlOTQlNUNweiU5MGtvJTdCJThFJTVF","55937369");
where you can check that the value inside SHOW_CNT is the number you want.
If you want to know how I figured out which request and which script was populating that response tag, well that I did using firebug, searching for SHOW_CNT inside all of the responses that involve calling to your URL, which pointed to the request I specified, and then trying to check who was requesting that.
Hope it helped.
support#import.io are the guys to speak to, they give free advice and help trouble shoot problems just like this all the time.
There are all kinds of tips and tricks you can use... for example import.io provide (an undocumented beta) JavaScript Pre-render service that would likely work for you in this scenario. API publish failures are sometimes caused by timeouts while waiting for sites to render JS, this would fix that.
http://support.import.io/knowledgebase/articles/623235-infinite-scroll-and-javascript-prerender-beta
I hope this helps.

How to prepare POST data from a previous HTTP response?

I've used Fiddler to capture these HTTP calls. Here's the problem:
I have a HTTP-POST data that looks like below:
Notice how it has many 'employeeIds' and also 'shiftSumIds'.
Now, these Ids are from a previous HTTP response that looks like below:
Is there an easy way to extract those Ids and prepare the POST data? Thanks in advance.
--Ishti
Short answer is JSON Path Extractor available via JMeter Plugins which is designed for getting "interesting" values from JSON data. See Using the XPath Extractor in JMeter guide (look for "Parsing JSON" chapter) for installation instructions and some form of JSON Path language reference.
If it is not enough and you will need some assistance in constructing JSON Path query and building HTTP Request from it - please include text version of response and request using i.e. http://paste.org service as reading large amount of text from small screenshot isn't very handy and chance of getting the answer is minimal

How to extract value passed in the URL and use it as parameter in Jmeter?

I am using Jmeter for my performance testing and I am stuck at the point where I need to extract the value from the URL and pass it to Jmeter.
Here is the example:
Application requires user to create an order and then submit it on the next page
I am at a point where I can create an order using Jmeter.
In order to create a script to submit an order I have copied the url from the web page as passed it as a GET method '/order/submit/23'. This '23' number changes everytime I create a new order
The issue I am having here is when I run my jmeter script it creates another order with another number which then mismatch with the '/order/submit/23' url I have passed.
Is there any way to extract this number from the HTML code and pass it to Jmeter?
I looked into the HTML code and this number is a part of URL so not sure how I can extract it. Any suggestions please
I am looking for something like /order/submit/${var}
Thanks
If I understood you correctly, you need to extract some value from response. You can do it with two samplers:
XPath Extractor
RegEx extractor
I think xpath extractor more appropriate in your case

Resources