Need to extract value from UI using Xpath - using Taiko framework - xpath

Am trying to extract value from the field. I can use only Xpath to identify the field.
tried
$(xpath).text() - i think since am tring to extract vale it returned 0
$(xpath).value() - did not work
textBox().value() - inside text box am able to pass id, name. but i need to pass xpath to get the value.
Any solutions?

you can use the evaluate api to return the value.

Related

How to write assertion for dynamically change dropdown value in Jmeter

I have prepared my script using Correlation-regular expression. How can I provide the assertion for account which is selected from .csv file. Here the account selection is stored in a regular expression as follows.
CSV_Data_set_Config, CSV_File_info, Account_Selection_From_UI, Regular_Expression, Sample_Thread_Group, Response_Assertion
Your screenshots are very beautiful but you need to specify what do you want to compare with what in order to get a comprehensive answer.
If you need to compare this 0048852 with the value from the CSV file you need to:
Extract this 0048852 using Regular Expression Extractor or Boundary Extractor
Add Response Assertion as a child of the request and configure it like:
For more detailed response you need to share at least partial HTML code of the page where the dropdown is selected showing the dropdown markup and indicate what exact value you need to "assert"

Is it possible to extract dynamic values from the Response URL through JMeter before it appears in the Response?

Please refer the image displayed on clicking the link : https://i.stack.imgur.com/O0lSD.png
Questions:
Is it possible to extract the highlighted values - Blazor ID and Timestamp in JMeter even when the response fails? (Since these values are unique, dynamic and change for each session - it fails on rerunning them)
Is it possible to create/record > amend > run JMeter scripts when we have such dynamic and unique values involved?
Yes, you can extract them from URL using either Regular Expression Extractor or the Boundary Extractor, just make sure to use the appropriate "Field to check", in your case most probably it will be URL
With regards to the "timestamp" - it can be generated using JMeter's __time() function if it is not present anywhere.

How to extract QueryString value using NiFi processor/language expression?

I am wondering how to extract a querystring value from incoming url using NiFi.
Initially, I started by implementing UpdateAttribute:
For example, I would like from the incoming url http://smth.net/hello?val=23
to have value of 23 extracted.
Further, I expect that I can use that extracted value by referencing it in following way:
(InvokeHttp processor) http://some.net/getValues?id=${q}
Any hints appreciated!
Edited question:
The flowfile inspect after extracting query string looks like:
you could use UpdateAttribute with replaceAll (regular expression):
${url:replaceAll('.*[\\?\\&]val=([^&]*).*','$1')}
maybe regexp could be optimized...
Actually, the easiest possible way to retrieve a query string value is by using NiFi's expression like: ${http.query.param.[keyNameOfQueryString]}.. So, if the request URL is 127.0.0.1/hello?val=23 then the NiFi expression would be ${http.query.param.val}
Other way to do is using regex, as daggett suggested, but in my case I had to do the following:
${http.query.string:replaceAll('val=(\d+).*', '$1')}
Note http.query.string in place of url.

Besides Xpath, how do I capture custom attributes

I'm trying to capture the date of an object but the object does not have id or name attributes. Also there are multiple items with the class of "ng-binding" so I don't think I can use that.
Is there a way for me to capture values from objects using custom attributes? Meaning is there a way for me in Ruby to say
varObject = find_element(:ng-binding-html, "$ctrl.app.publishedDate")
The object I'm trying to capture is
<span ng-bind-html="$ctrl.app.publishedDate" class="ng-binding">11/20/2017</span>
I took a look at an older post which seems to be close to the same issue I'm having but I was sure.
Selenium webdriver : how to find the element in DOM based on custom attribute
Thanks,
Scott
Is there a reason why you don't want to use XPath? The Ruby Selenium WebDriver find_element method that I think you refer to in your question accepts XPaths as an argument.
You could use the following XPath:
"//span[#ng-bind-html='$ctrl.app.publishedDate']"
Your Ruby code could be:
varObject = #driver.find_element(:xpath,"//span[#ng-bind-html='$ctrl.app.publishedDate']")

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