Jmeter load testing in SPA - testing

I am beginner in Load testing and I am doing load testing using JMeter on a single page web application. The issue which I am facing right now that as you know in SPA there is a single URL and page contains multiple tabs, how I can switch between the tabs using JMeter. You can see my test plan in below image.
I Know I have little knowledge, any link or guidelines are welcome as there is a limited information on google regarding SPA.

Do not compare the load testing with automation testing. Jmeter can only trigger the request that your system is sending to server. The steps you need to do:
Open your URL in chrome/firefox
Inspect the page or tap f12 on keyboard.
Go to network tab
Now click on the tabs you have in your webpage
check if there is any request being passed to server when navigating through tabs.
If yes, replicate the same request by adding a HTTP Request in jmeter and provide the request headers and parameters same as that of the request being passed.

Related

JMeter Screenshotting

I am able to get a screenshot in my JMeter test scripts using the Selenium chrome web driver. This works, but now I want to get screenshots following an authentication request. Is there a way to capture the screen as displayed in the HTTP request?
I don't think there is, theoretically you could try libraries like this one or this one from JSR223 Test Elements using Groovy language, but I don't think you will get what you want
The main reason is given at 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).
HTTP Request sampler downloads only HTML, you won't get any images, scripts, styles, fonts, etc. so even if you try to use the aforementioned libraries you will get a "screenshot" which doesn't have anything in common with how does the page look in reality.

Using form submit from script on extension page

I'm developing an extension for Chrome, Firefox and Safari and I'm adding a feature that uses a form.submit style post to initiate a search on another web site.
I have the code working in Chrome using the method described in this post:
Chrome Extension Development - POST to new tab
However, it doesn't work in the Safari extension. There are two problems. The first is that the sendMessage to the new tab never gets to the post script. I found a solution to that: in Safari it doesn't treat a script loaded by an extension web page as a content script. So I have to use runtime.sendMessage rather than tabs.sendMessage.
The second problem is where I am stuck. The post script submits the form but there appears to be an error on the server side and I am unable to see what it is.
In the Safari Web Inspector the "Preserve log" doesn't keep the log when this error occurs. The server loads a new page (with blank search fields) and I can't see any info on the request header sent with the post or the response since the Web Inspector logs are cleared.
I suspect it may be a security issue since Safari tends to be more strict. Any ideas on any ways around this?

How to make sure video script in JMeter is actually working? Type a message

I have a url https://www.dummyvideo.com/ As soon as this url is hit, there is a single video which starts playing. When I check on browser, segment is not showing in response. Same is the case in JMeter. I would like to know which protocol should I use for acfor achieving this goal. Also, how do I conclude that if my script is working as I dont see segment response on browser as well as on JMeter.
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).
The video is being "played" via JavaScript function call and JMeter doesn't automatically "play" the video as it's not capable of executing JavaScript
Since your URL doesn't lead to the website with the video I can only give general recommendations:
If it's possible to find out the exact URL of the video from the page source you can extract it using a suitable JMeter Post-Processor and add another HTTP Request sampler which will download the video
If the video is in form of M3U playlist you can use JMeter HLS Plugin which parses the playlist and gets media streams out of it
In both cases make sure to add a relevant Timer to simulate the user watching the video before proceeding to next page/iteration

How can selenium automatically capture the value from an existing web browser page and use that value in the new session?

The issue here is I'm trying to scrape a value which is displayed in a current webpage that I'm in and selenium has to capture that value and do certain operations accordingly. The value is dynamic and that webpage can not be reopened through selenium.
The websites can only authenticate the browsers using Cookies which are basically special HTTP Headers so if the browser sends the cookie the websites expects - the website "recognizes" the user and vice versa.
If you want to continue where you left off with Selenium you need to export cookies somehow from the existing session and add them to the browser which is driven by Selenium, there are several API methods which allow cookie manipulation, refer your Selenium client library documentation for specific instructions.

How to detect if a URL fires upon loading a page

We're trying to validate if a URL fires upon loading a web page. Is there a way to do this programmatically using Selenium RC? The event does not appear within the page HTML or DOM.
Thanks.
Can you specify the URL as part of your test?
If so, then what about running a httpd server and checking if it gets a hit when your page loads?
The selenium.start("captureNetworkTraffic=true"); enables the 'capture' of all the HTTP requests/responses associated with the loading of the web page. Once formatted, these results can be reported easily.