I am trying to access the 'successURL' element of a response payload in chrome console, but cannot work it out. I've tried everything I can think of --> payload.successUrl, e.payload.successUrl, data.payload, but can't seem to access the element.
Anyone able to help? Thanks!
As you shown on image attached to your question - you have successfully accessed this in chrome console :)
You can now right-click to see context-menu and copy it to a variable or do some other things.
But If what you mean is to access data from developer tools straight away in a script - it's rather impossible.
For more information on that - read this aswered here: https://stackoverflow.com/a/50571792/3054380
If the request resulting with that payload data was made by your script - then you need to show how you did this - and surely it is quite simple to access any data recieved in response.
I found the answer in my question from webdev-dan and Tch (I can't upvote them as I don't have the reputation, sorry!). I was trying to access the response after it was posted to console as opposed to parsing the data in my script then sending to console.
Here is what I did to get the element from the response I needed (successUrl).
Javascript
const result = await frui.getSession();
console.log(result);
console.log(result.payload);
console.log(result.payload.successUrl);
Response in console
I'll now set the result.payload.successUrl as a variable to use later on.
Related
I have a few test steps set up in SOAPUI with a property transfer step in between to transfer the sessionkey from one response to the next. The problem is, that the response is putting "" around the session key, and these need to be removed in the property transfer.
I used to have a working script that did just that:
def response = messageExchange.responseContent
response = response.replace("""","")
messageExchange.modelItem.testStep.testCase.setPropertyValue("jsonResponse",response)
However, this is no longer working and gives the following error: "Content not allowed in prolog".
Has anyone got any idea what causes this? It was working fine, but after having used SOAPUI for a few years, its now throwing this error..
Thanks!
I am using jquery upload for chunked uploads. Creating a new file and first chunk in my php back-end goes fine, but for the rest chunks I need a file-ID to tell my php script where to append file data.
So my problem is I don't know a way to read the response (ie. file-id) from ajax with jquery upload and edit the post data, in this case add the file id to the requests after the first chunk. The responses seem to behave mysterically.
I console log in my progress-callback console.log(data) and I get a buch of stuff. I can log ie. console.log(data._progress.field) but cannot do this for data._response.file-id as console says undefined. But when i console log the whole data I can clearly see a _response -object inside data. but when I specifically try to log that I get Object { } so it seems to be empty, but when i click it I see jqXHR-object and result-object that has the file-id I want to put to post requests for the rest chunks.
TL,DR:
I can console.log whole data in callback and see the result ie. file-id, but when I try to log data.result.file-id, console says "undefined".
Some fields I can log but some I can't Ie. data._progress.total logs just fine but data._result doesn't.
I need a field from response and change the post parameters for the next requests of chunked file upload.
What on earth I am missing here?
EDIT:
I have found a back-end solution to my problem and I didn't need jQuery/ajax request response things I tried to use. This was proprietary works so sorry I can't post my code.
Using GWT I am loading images from a server I do not control. Currently, I use GWT new Image( url) and then use ImageHandlers and ErrorHandlers to catch what happened and put the images in my buffer and the DOM. Then I make the images visible sequently to animate the process. But now I need a bit more, I need to know the error code, e.g.304 that the server returned for the image and also I need to get at the header response attribute, 'Last-modified'. For 304, I know I need to resubmit the request later when the server will have created a new version ( with exactly the same url ) which I think I can manage, but it will then have a new 'Last-modified' and I need to know that DateTime.
By using new Image(url), I am letting the browser do the loading, but I don't know how to get at the details of the load.
Q1:Is there a way to pull more info from an image?
GWT Image just seeems to wrap a JS object. I look in Firefox Console-Network, but don't see much detail there either. Is Last-modified and error code forgotten by the time it gets (or doesn't) in the DOM tree.
If the answer to Q1 is no the information is gone or inaccessible, ..
Q2: Do I need to stop using the browser to fetch images and do it with an XmlHttpRequest and then presumably I have access to the response codes and the header attributes. SOP is not an issue. But how then do I get from say the Response OutputStream to an Image? Do I have to Base64 encode it or is there a better way? Will one of the other non-url constructors for image help, say Image(Element) or Image(ImageResource). Then the issue becomes how to make a response stream into a Element or ImageResource?
Note: This other question 'How to print error message of why image failed to load?' is related, but doesn't get to an answer.
Getting Error codes, and getting the response as a stream must be done with an HTTP client (GWT has the built in RequestBuilder). You can also try to get the error code with native JS, using the method described here.
I am trying to access a remote json file using YUI, example code can be seen in the jsfiddle below. The request goes off to the server (you can see it in Google dev tools network tab)
. The on success or failure functions don't get executed which I can't understand
http://jsfiddle.net/brendan_rice/4FZc4/3/
Can anyone help please?
Your datasource must support the callback syntax, wrapping the data with callback([...]);
Read the first section (in blue) http://yuilibrary.com/yui/docs/datasource/datasource-get.html
I figured out the issue by putting in YUI({ filter: 'debug' }), which showed that there was a syntax error in the .Get request (which is indicative of sending over unwrapped JSON data).
Also, if you just want the raw data from a cross-origin request and don't need a real DataSource instance, you may find Y.jsonp easier to use (http://yuilibrary.com/yui/docs/jsonp/).
Anyone, help me, how to get Headers and PostData inside extension, using xpcom/something else?
i cant find functions inside firebug due to it is big codebase... thank you guys
I am assuming that you want request headers, not response headers. Then you register an observer for the http-on-modify-request notification. The general documentation is https://developer.mozilla.org/en/Observer_Notifications#HTTP_requests, a code example can be found under https://developer.mozilla.org/en/Creating_Sandboxed_HTTP_Connections#Handling_cookies. Getting the headers is easy, you simply call nsIHttpChannel.getRequestHeader().
Getting response headers is similar but you need to listen to http-on-examine-response notification and probably http-on-examine-cached-response as well.
POST data is tricky. You can get the upload stream as httpChannel.QueryInterface(Components.interfaces.nsIUploadChannel).uploadStream. But the stream can only be read once - it is either you or the code sending data to the server. So you need to replace the stream by something that looks identical but allows you to peek on it - probably nsIInputStreamTee where you set the original stream as source and nsIPipe as sink. Not sure whether this is the approach chosen by Firebug.
Wladimir is right on for the headers. For the POST data, here's a couple of code snippets with a little more detail:
https://developer.mozilla.org/en/Code_snippets/Miscellaneous#Getting_postData_of_a_webpage