How to use Xpath extractor to extract mutiple fields using SOAP request in Jmeter? - apache

I imported the webservice and did my first transaction passed. I see the request and reply xml
Now I want to extract ton of field values from the reply xml that I got and need to pass into Request xml.
For one field I know how to do that. I use Xpath Extractor to extract like this
//*[local-name()='Data']/text()`.
In the next action, I can just use as ${Data} which is working fine.
But I need to extract the text content from ton of fields that need to be passed into the next action.
How to do that using Xpath Extractor?

If your XPath query matches multiple /Data/text fields they will be caught as
TEXT_1=first match
TEXT_2=second match
etc.
If you need to combine results from different queries it can be done via pipe sign - | like
//*[local-name()='Data']/text()` | //*[local-name()='Something else']/text()
In this case result will go to the single variable.
Third option is using as many XPath extractors as needed.
See XPath Tutorial for general language reference and Using the XPath Extractor in JMeter guide for more tips and tricks.

Related

Jmeter :- ArrayList Handling in Parameters tab

Case: Select 100 records and mark them verified.
Steps:
Getting 25-100 records based on IDs via JSON extractor.
Posting verified on 25-100 records selected.
Actual Result: (Getting 500 Error)
Expected Result: (How it is working in application)
How can I handle the above case?
Your format is not correct, you need to send the data like:
The request body can be generated dynamically using JSR223 PreProcessor and some Groovy scripting, check out HTTPSamplerBase.addArgument() function for more details.

Sensenet: Search by Content List fields on Query Builder

I'm trying to make an query on Query builder. This query should search by content using the Content List fields.
In the documentation is indicated that I can use CQL but it seems that in this case is not working.
The query that I'm trying to make is:
TypeIs:File AND #Location:Lisbon
The # char should be url encoded (because the query will be executed by an ajax request through OData). So use it this way:
TypeIs:File AND %23Location:Lisbon

Using regex while finding web element by id in Selenium java

I am trying to locate web elements using the element id. But the id of the same web element changing between
Driver.findElement(By.id("ItemDetailsCompView.**Edit**ViewUIElement_Field_Tab_2_Product_Materials"))
and
Driver.findElement(By.id(ItemDetailsCompView.**Display**ViewUIElement_Field_Tab_2_Product_Materials"))
This results in to an error when I have hard coded for one id and the other id occurs. Is there a way to create a string that searches for Edit / Display words in the id.
I am unable to use Xpath as my webpage is complex and consists of various nested tables.
You could try using a CSS selector (the syntax may be incorrect here, it's not clear what language you are using):
Driver.findElement(By.CssSelector([id*="ViewUIElement_Field_Tab_2_Product_Materials"]))
Even better if you can provide an element tag name on that.

Date range search using Google Custom Search API

I am using the Google Custom Search API to search for images. My implementation is using Java, and this is how I build my search string:
URL url = new URL("https://ajax.googleapis.com/ajax/services/search/images?"
+ "v=1.0&q=barack%20obama&userip=INSERT-USER-IP");
How would I modify the URL to limit search results, for example, to: 2014-08-15 and 2014-09-31?
You can specify a date range using the sort parameter. For your example, you would add this to your query string: sort=date:r:20140815:20140931.
This is documented at https://developers.google.com/custom-search/docs/structured_data#page_dates
Also if you use Google's Java API you can use the Query class and its setSort() method rather than building the URL by hand.
I think the better way is to put this into query itself. Query parameter contains 'after' flag which can be used like:
https://customsearch.googleapis.com/customsearch/v1?
key=<api_key>&
cx=<search_engine_id>&
q="<your_search_word> after:<YYYY-MM-DD>"

where to see xPath Extractor results in Jmeter

I am new to Jmeter, I want to see the Xpath Extractor generated results.
I have
Reference Name : pt_idx
Xpath query : //patientList/patient/idnetifierList/identifier/text()
Default Value : 0
Please clarify my doubts, can i use Xpath query generated results in Http Request?
Is those result will store in pt_idx variable?
Finally, where can i see the results?
Yes, you can use it in an Http Request, I have previously used several XPath Extractors and been able to use them as variables in subsequent http request using the placeholder notation ${varname} (for you it would be ${pt_idx})
To verify the value of the variable, I could do it via the report by looking at the HTTP Request (as I used the variable to fill a request parameter).
Hope it helps.
Finally, where can i see the results?
Add a Debug sampler by going to the thread group and right clicking Thread group -> add -> sampler -> debug sampler. The debug sampler will give the values that the XPath Extractor retrieves. Simple add a View Results Tree and select the debug sampler and view the Response data tab and the info should be all there.