Jmeter script waits for some time after clicking menu button - google-chrome

I am clicking on a Menu Item which takes the user to a different page on the application. After clicking menu item , script waits for few seconds or more than a minute sometimes before moving ahead to the next step. There are no wait/delays etc after click and have verified from logs that it keeps waiting after clicking menu item and does not move ahead to the next line. This is the description of menuitem (using chrome sampler)
id="SummaryMenuItem" href="../AppsView/page.aspx?ViewID=cc1d569c-6f26-4a4f-bc64-86fb1fdbb236&Layout=MarketData&Theme=Default" onclick="addToNav('../AppsView/page.aspx?ViewID=cc1d569c-6f26-4a4f-bc64-86fb1fdbb236&Layout=MarketData&
My chrome sampler script
wait.until(conditions.presenceOfElementLocated(pkg.By.xpath('//div[#id=\'navMenuSubs\']//*[#id=\'SummaryMenuItem\']')))
var subMenu = WDS.browser.findElement(pkg.By.xpath('//div[#id=\'navMenuSubs\']//*[#id=\'SummaryMenuItem\']'))
subMenu.click();
Can anyone suggest why script keeps on waiting
Thanks

Usually clicks are not recorded in the jmeter but the request initiated by the click (click event-->request to the server) is getting recorded. If co-relation is not done properly then it may not proceed further.
If there is no request send due to click then nothing will be recorded.
Hope this helps.

Related

Check if a new if a new tab was opened with puppeteer

I am using Puppeteer to gather a list of companies that hire remotely. The page I am trying to collect the data from has a call to action that is not an <a href="" blank"_tab", but a <button></button>. The button doesn't have any data attribute either, that gives a hint as to what the URL of the page that gets opened in a new tab, when I click the button, is. I am now trying to find a way to catch the opening of the new tab, by clicking the said button, to then fetch the URL of the newly opened tab. Is this possible with puppeteer?
The solution is to extract all pages of the browser via the browser.pages() method call.
In your puppeteer project you always start by initialising the browser. The puppeteer virtual browser does contain the method pages(). Usage of pages().
What you have to do now: At first get the current url of the current page you are on. Then stream the result of the browser.pages() method. While streaming the array you can just get the index of your current tab. The tab you just opened using the button is the page with that index + 1 (the next element in the array)...
How to handle multiple tabs
Puppeteer Documentation about pages()

Is there a certain page I should be fetching my API data from within my Chrome Extension Project?

I am making a chrome extension that fetched JSON data from CoinMarketCap.com API and currently I have it running in the background script. I'm not 100% sure what the purpose of the page is really. I was wondering if I could simply fetch the data from the popup script after I click a button within my popup?
Each button represents a different coin. I basically want to get the price of a chosen coin and display it on whatever page the user is on when they double click the coin in a text article. Eventually I want to make it so you can double click any coin and have it show a live price conversion while you're on the web-page.
The point of a background page is to be always available (running if persistent: true, woken up / recreated for registered events if persistent: false).
A popup's lifetime is determined by its visibility. The moment the user clicks away and closes it, the page is closed (as if the tab with it was closed), so it can no longer process any events and its state is lost.
As long as:
The data you need fetched is to be received/processed while the popup is open
Any state you need to persist between popups being shown can be stored in chrome.storage
Then you don't need the background page to do the fetching. Popup page has the same level of access to Chrome APIs.
However, consider this scenario: suppose you want the data to be ready as soon as popup is opened (at least, you want it to be fresher than "since last time"). You may want to do periodic updates even while the popup is closed to refresh the data. You can only do that reliably with a background page (and, say, chrome.alarms API). Then you can cache the latest available data in chrome.storage and use that in the popup.
Background pages have their uses as some code that can run periodically regardless of user actions, and to be able to always react to events.
According to Changes to Cross-Origin Requests in Chrome Extension Content Scripts now you have to do your fetches in Background Script. Not in Content Script.

Pressing back button does not suspend/terminate application

I've created an app with secondary tiles. The tiles leads to Page2.xaml of the application. So when the user clicks it, the app opens on that page (Page2).
Ive added the following at the end of OnLaunch in app.xaml.cs:
foreach (string id in ListOfId)
if (id == e.TileId)
{
rootFrame.Navigate(typeof(Page2));
}
Pressing back button (hardwarebutton) leads back to Page1, the first page of the application. Thats the wanted behaviour. The problem is, if I then press back on the Page1 it only flips the page... seems to reload it?
If I start the application by its default tile that leads to Page1, and then press back button the app suspends (expected).
Can I trigger suspension of the app in code? I can override hardware back button and might solve my problem that way

Back button not triggering the method within the "beforeunload" in Chrome

Im using the jquery event beforeunload $(window).bind('beforeunload') to make an api call after a user closes the browser, or a tab, or hits the back button. It works fine in Firefox, but not completely in Chrome. In Chrome, it works when the user closes the browser or tab, but not when the user hits the back button. The method is supposed to remove the user from a list of "current active users" whenever they close the browser or tab or leave the page. For some reason in Chrome, the history api isn't removing the user whenever they leave the page via the back button. What could be causing this? Thanks.
I am not sure why this happens but, personally, I wouldn't rely on this. What if the users' computer crashes? A browser will not fire that event - it won't have the chance to. Best bet would be to call a page via ajax or something similar, every 5 seconds or so, and that page updates a date related to the user. You then show users where the date is within the last minute, or whatever you decide, in the list of currently active users. If their computer crashes, the date will no longer be updated.
Regards,
Clarkey

Caching if visit same page twice: back button only shows data from second viewing

I am creating a webpage and am having some issues with how the back button works on the page. I am guessing that I need to set some headers, but don't know which ones or how. This is what I'm seeing:
(1) Go to the main page, which shows forum threads.
(2) Click a link to go to a page showing a thread. On this page, scroll down and add a comment.
(3) Comment is saved via form (edit: I have tried both POST and GET form). The same thread page is now reloaded via a redirect. The comment shows.
In Chrome: pressing the back button at this point still shows the comment as having been added. It looks as though the back button didn't work. However, the page is scrolled down as it was for (2). Clicking the back button again shows the main page. So, the back button does take me back, but if the same page is there twice, it shows the new data both times.
In IE9: pressing the back button displays "Webpage has expired". Clicking it again takes me to the main page.
How do I alter this behavior so the back button truly shows me the previous page?
(The reason I'm doing this is that I keep track of how many pages I am from the main page so I can generate a "back to main page" link. (2) above has history.go(-1) and (3) above has history.go(-2). This won't work if the user presses the browser back button from (3) since it will now be 1 away from the main page, but show the link from (3).
In step (3) you probably have a POST that returns the new HTML of the thread page. Instead the POST should redirect to a GET of the thread page.
See http://en.wikipedia.org/wiki/Post/Redirect/Get