Capturing query duration using selenium & robotframework - selenium

I am using Selenium and Robotframework.
I want to:
submit multiple search values sourced from a csv file
capture the search result values and write out to csv file
capture the duration of the query
How do I do step #3?
Should I be looking to use HAR and parse that for the duration, or is there a way for selenium and robotframework to access this value for each query and write out to file?

You can do this with selenium: https://www.lambdatest.com/blog/how-to-measure-page-load-times-with-selenium/
Browsermob proxy (HAR) should help you measure the request time, especially of ajax responses: https://www.tothenew.com/blog/browsermob-proxy-for-webpage-load-testing-using-selenium/
However if you're just hitting one endpoint (with different requests), you probably want to look into a tool like jmeter: https://jmeter.apache.org/usermanual/glossary.html

Related

Client-side automation using PageSpeed Insights - how to transmit results like <URL>_<metric> into Summary(/Aggregate) Report in JMeter?

I'm thinking on solution to automate client-side using Lighthouse or PageSpeed Insights in JMeter.
With PageSpeed Insights, using requests like
https://pagespeed.web.dev/report?url=%2F&form_factor=mobile
https://pagespeed.web.dev/report?url=%2F&form_factor=desktop
it is possible to get web-page which contains client-side metrics and parse out their values to variables:
URL_First Contentful Paint (FCP)
URL_First Input Delay (FID)
URL_Largest Contentful Paint (LCP)
URL_Cumulative Layout Shift (CLS)
URL_Speed Index
URL_Time to Interactive
URL_Total Blocking Time
...
i.e. URL_metric - as variable name, where both URL and metric could change.
The question is, if I want to see the results statistics in JMeter "Summary Report" or "Aggregate Report" view for each combination of URL and metric, what is the best way to pass these variables names (URL_metric) as Label in JMeter?
You could dump the saved values to a file in usual JMeter output format (JTL):
{timestamp},{duration},{sample_name},200,OK,thread_group_name 1-1,text,true,,0,0,20,65,null,0,0,0\n
Curly brackets denote placeholders.
You already have durations and sample names, timestamps do not matter in your case since you only wish to have aggregated results.
After saving the data to a file you could open it with Summary Report or Aggregate Report.
In order to get client-side metrics you will need a real browser, as per JMeter project main page:
JMeter is not a browser, it works at protocol level. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever displayed at a time).
So in order to get client-side metrics from JMeter you need to kick off a real browser, for example take a look at WebDriver Sampler which provides JMeter integration with Selenium browser automation framework, check out Mixing Selenium Into Your Load Scenario for more details.
Once you have the metrics you can store them into JMeter's Sample Variables and plot them in custom charts of the HTML Reporting Dashboard

Katalon - Verifying form data by checking the network request

I am using a Katalon tool + groovy scripts for UI automation.
The page I would like to test has a number of filter fields of a different types (text fields, date pickers, etc.) and submit button that sends the request to the server.
I wasn't able to find any relevant information for the following issue:
is it possible to get the request that was sent by the browser to the server in order to parse and verify the parameters values?
Thanks in advance,
IM
I think you have to distinguish between UI and API Testing. For UI-Test you have to check the behaviour of UI and the correctness of all elements that are displayed.
With API Testing you can verify that your request are receiving correct status codes and responses for different sent form data.
For API Testing see https://docs.katalon.com/katalon-studio/tutorials/introduction_api_testing.html#what-is-api-testing

How to check in jmeter if entered fields remain same in the first page after navigating back from nth page

I want to test a page.Where i want to fill up the fields like first name last name etc.and after going two pages further if i come back to the original page by using back navigation ,data entered for first name and last name remains the same.or it is filled up.
In jmeter i want to check the same if data entered for the fields remain same if i navigate back .
How can i achieve this.
I tried gving url directly in the path its not happening since it is not the way.
please help me since i'm new to jmeter.
You need to understand 2 things. How JMeter works and how your application works.
JMeter only captures data that is communicated to server. It does not matter how data is entered from UI. It does not check if data retains in the fields or not. It only records the request that is sent by your application to server-side.
So, if you understand above, you also need to understand how your application sends data to server. Does it sends the request as you move from first page to second. Or does it send (Submit) data on final page.
Either way, JMeter is not a tool to test if your form fields are retaining data in them as you navigate between pages. As mentioned earlier it only monitors data requests/responses.
Selenium seems a better option for your test requirement.
Please read the apache documentation carefully:
JMeter is not a browser. As far as web-services and remote services are concerned, JMeter looks like a browser (or rather, multiple browsers); however JMeter does not perform all the actions supported by browsers. In particular, JMeter does not execute the Javascript found in HTML pages. Nor does it render the HTML pages as a browser does (it's possible to view the response as HTML etc., but the timings are not included in any samples, and only one sample in one thread is ever viewed at a time).
First, you have to understand how JMeter works!!! To do the Functional Testing, Selenium would be a good choice.
Thanks

Can I use Selenium with password-protected URLs?

I'm trying to use Selenium for fetching information automatically from an ADSL modem's status page.
To log in to the modem, it requires certain username + password combination. Unlike all the samples that I have found, this comes before fetching the page, and therefore is not the case of finding the right id and then 'typing' the text into them.
Does Selenium have support for reaching such access controlled pages?
If I understand you correctly, if you use the following url, it will work:
http://username:password#modemstatusurl/bar/foo

Excluding Selenium-server URL in JMeter Proxy Server

I'm currently trying to get JMeter to record the steps my selenium tests so I can perform load testing with the same tests. The steps are recorded fine but my problem is that its also recording the steps performed in the "selenium-server" window (i.e. the extra windows that pop up when selenium runs).
I believe if I add something like *selenium-server* to the "URL Patterns to Exclude" List then it will ignore all these steps but they keep recording for every pattern I've tried.
Can someone please tell me the pattern which will lead to these steps getting ignore?
An example url is: /selenium-server/driver/?retry=true.
Thanks.
Try adding the following to 'URL Patterns to Exclude'
^/selenium-server/.*
If you're trying to use your Selenium tests to generate load, you might also want to look at BrowserMob. It's a company I started that runs actual Selenium browsers en masse in the cloud.
You could try to add the following to 'URL Patterns to Exclude'
.*/selenium-server/.*