how to get threadid from puppeteer page object? - puppeteer

Is there a way for me to get the number of the process to which the page object belongs? I want to use puppeteer to get the loading error of a page resource, but I can't find the correspondence between the intercepted error request and the page object. I found that the _requestId of the intercepted request is combined using the process ID, so I want to get the process number of the process to which the page object belongs.

Related

Extracting value from Json response of POST request in Jmeter using Json Extractor

Post request Json Extractor Get request debug sampler error message I'm using Jmeter for stress testing of my application. Test plan that I'm building has a POST request which creates a user and the next PATCH request updates it. Basically I want to extract user_id from Json response received after POST request and add that id in the body of the next request. For that I use Json extractor in my POST request and when I check Debug Sampler the value is successfully stored. But when I try to use extracted user_id in any subsequent requests of the same thread it is not recognized. However when I tried to extract user_id of already created user with GET request then this user_id is normally recognized by other requests. I'm not sure whether Json extractor is not normally used with POST requests or I'm doing something wrong.
It's impossible to provide an answer without seeing the screenshot of your Test Plan or even better Schematic View (the option is available under "Tools" main menu entry since JMeter 5.1)
Given you're able to see the extracted value in the debug sampler I can think of 2 possible options:
Your syntax of referring the user_id variable is wrong, in JMeter the Variables are accessed like ${user_id}
Placement of your JSON Extractor is wrong, i.e. instead of putting it as a child of a specific sampler you have it at the same level as all Samplers therefore it's getting applied to the Debug Sampler as well and the extracted value gets overwritten. See Scoping Rules user manual section for more information

how does google-cloud-function generate function-execution-id?

A Cloud Function triggered by an HTTP request has a corresponding function-execution-id for each calling request (in the request and response header). It is used for tracing and viewing the log of a specific request in Stack Driver Logging. In my case, it is a string of 12 characters. When I continuously do HTTP requests to a cloud function and see the function-execution-id, I get the result below:
j8dorcyxyrwb
j8do4wolg4i3
j8do8bxu260m
j8do2xhqmr3s
j8dozkdlrjzp
j8doitxtpt29
j8dow25ri4on
On each line, the first 4 characters are the same "j8do" but the rest are different, so I wonder what is the structure of function-execution-id.
How was it generated?
The execution id is opaque, meaning that it doesn't contain any useful data. It is just a unique ID. How it was generated should not be of any issue to you, the consumer. From examination, it looks like it might be some time-based value similar to UUIDv1, but any code that you write that consumes these IDs should make no assumptions about how they were generated.

Is it possible for "view page source" to return different data to Google Scripts' "UrlFetchApp"?

I am trying to find a specific source of data programmatically on a page:
https://finance.yahoo.com/quote/3DP.AX/financials?p=3DP.AX
When I "view page source" on the page, I only find once instance of:
,"3DP.AX":
after which the data I require occurs. So in my code, I have:
UrlFetchApp.fetch("https://finance.yahoo.com/quote/3DP.AX/financials?p=3DP.AX").getContentText().indexOf(",\"3DP.AX\":")
^^ this however returns -1
I managed to find the data I need in the response of UrlFetchApp and discovered it occurs after:
{"quoteData":{"3DP.AX":
However, I cannot find this string in view page source. I cleared my cache and this didn't change the page source results.
Question: Is it possible for the data on "view page source" to be different from the data returned by UrlFetchApp?
It is possible for there to be a difference between what UrlFetchApp.fetch receives and what a browser request receives. However, you don't have enough information to reach that conclusion based on your current code.
To access the results of a Fetch request, you need to call getContentText() on the result, currently you are calling indexOf on an HTTPResponse object, not the text body of the response.
Additionally, you should pass a proper string literal to indexOf() - indexOf(',"3DP.AX":')

Sequence of events for Fuzzy search on html page

I have a page html let's call it abc.html
There are AngularJS fields embedded in it.
I am now writing a GET and POST in scala which routes the fuzzy search arguments to the proper page on the server.
I am trying to understand the sequence in which things occur in order to implement a GET/POST requests (written in scala) which would happen when someone makes a search on the search bar on the abc.html page, and which would return elements from the database
Is it abc.html (search) --> http GET request --> backend ( AngularJS) --> Database?
In this case this would mean my http post or get request would pass in the html data model elements which would in turn hit the backend AngularJS controller page which in turn would hit the database, and the return ride would send the database results via an http request to the page?
Do I need to explicitly define my GET in terms of angular fields and the database model?
thanks
HTTP uses request-response pairs. This means you don't have to make another request to return anything to the client, you just need to write the proper response. Other than that, your idea is fundamentally right. The process would look something like this:
Type something into the search form on your HTML page
Submit the search form to your backend. This creates a GET or POST request depending on your form element's method attribute.
(At this point the browser is awaiting a response)
As the request reaches the server, your backend code can capture its data and make a query to your database.
(At this point the server is awaiting data from the database)
The database returns its results, your backend code is free to format it into a response to the client's original request.
The client receives the response and you can use your frontend code to display it to the user.

How to Run Http Samplers in sequence order (step by step as per the ThreadGroup Order)

Behavior of my application:
HTTP Request Login
..JSON Path Extractor - Im extracting the session id
Debug Sample - Checking the session id
HTTP Request -- Im passing the session id to these requests
HTTP Request -- Im passing the session id to these requests
HTTP Request -- Im passing the session id to these requests
If I run the above script for one time Im getting the expected results above requests are passing step by step process.
If I run the above script with - Number of Threads as 5 .Then Login is hitting for 3 times other urls hitting for 2 times.
I need to run the above script one order for number of times.
I'm not seeing any regular expression extractor which you would need to pass in the session ID from one request to another. Also, if your back end uses cookies make sure to add the http cookie manager.
Here are some good JMeter getting started videos which also cover what you're trying to do:
http://blazemeter.com/blog/jmeter-tutorial-video-series